module DistribBuilder module Versioner class VersionProcessor attr_accessor :major, :minor, :patch, :build def initialize(array) @major = array[0] @minor = array[1] @patch = array[2] @build = array[3] end def versions_hash { major: major, minor: minor, patch: patch, build: build } end # => 0.5.0 def only_version [major, minor, patch].join(".") end # => 0.5.0.0 def full_version [major, minor, patch, build].join(".") end def build_up! @build += 1 end def build_down! return if build == 0 @build -= 1 end def setup_build!(build) @build = build.to_i end def setup_version!(version) @major, @minor, @patch = version.split(".").map{ |d| d.to_i } end end end end