Sha256: e0b1e1ced9d1591d0158ab8793183d851e080870ebe0c45f2bfe6b5ec30a20cf
Contents?: true
Size: 1.17 KB
Versions: 4
Compression:
Stored size: 1.17 KB
Contents
module Versionator class Version include Versionator::File include Versionator::Git attr_accessor :major, :minor, :patch def initialize version_file_content = read rescue nil if version_file_content.nil? write version_file_content = read puts "Versionator file created: #{Versionator.version_file}" end categories = version_categories(version_file_content) @major = categories[0] @minor = categories[1] @patch = categories[2] end def version_categories(version_str) version_str.split(".").collect{|s|s.to_i} end def bump(category) case category when :major @major += 1 @minor = 0 @patch = 0 when :minor @minor += 1 @patch = 0 when :patch @patch += 1 end end def version_name [@major,@minor,@patch].join(".") end def git_release output = git_checkout output += git_pull output += git_tag output += git_commit output += git_push output end def release(category) bump(category) write(version_name) git_release end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
versionator-0.0.4 | lib/versionator/version.rb |
versionator-0.0.3 | lib/versionator/version.rb |
versionator-0.0.2 | lib/versionator/version.rb |
versionator-0.0.1 | lib/versionator/version.rb |