Repository URL to install this package:
|
Version:
0.0.5 ▾
|
module Buildgem
class Version
include ForwardGemMethodsToConfig
class << self
attr_accessor :args
def increment!(options = [])
@args = options.empty? ? %w(patch) : options
instance.increment!
end
def instance
version_class.new
end
def version_class
eval "Buildgem::#{version_type.capitalize}Version"
end
def version_type
args[0]
end
def method_missing(method_name, *args)
instance.send(method_name, *args)
end
end
attr_accessor :file_content
def initialize
@file_content = File.read(gem_version_full_file_path)
end
def increment!
content = file_content.gsub(current_version, new_version)
File.open(gem_version_full_file_path, 'w') do |f|
f.write(content)
end
end
def current_version
file_content.match(/VERSION = (".+")/) { |m| m[1] }
end
def new_version
raise "Please implement #{self.name}#new_version"
end
end
end
require 'buildgem/version/major_version'
require 'buildgem/version/minor_version'
require 'buildgem/version/patch_version'