Sha256: eb1242250735fcd8f0a17f06874245fe5888447fbb0205734a53746171be098e
Contents?: true
Size: 1.11 KB
Versions: 7
Compression:
Stored size: 1.11 KB
Contents
class << (helper = Bundler::GemHelper.instance) def mainfile "lib/#{File.basename(gemspec.loaded_from, ".gemspec")}.rb" end def update_version File.open(mainfile, "r+b") do |f| d = f.read if d.sub!(/^(\s*OptionParser::Version\s*=\s*)".*"/) {$1 + gemspec.version.to_s.dump} f.rewind f.truncate(0) f.print(d) end end end def commit_bump sh(%W[git -C #{File.dirname(gemspec.loaded_from)} commit -m bump\ up\ to\ #{gemspec.version} #{mainfile}]) end def version=(v) gemspec.version = v update_version commit_bump end def bump(major, minor = 0, teeny = 0, pre: nil) self.version = [major, minor, teeny, pre].compact.join(".") end end major, minor, teeny = helper.gemspec.version.segments task "bump:teeny", [:pre] do |t, pre: nil| helper.bump(major, minor, teeny+1, pre: pre) end task "bump:minor", [:pre] do |t, pre: nil| helper.bump(major, minor+1, pre: pre) end task "bump:major", [:pre] do |t, pre: nil| helper.bump(major+1, pre: pre) end task "bump" => "bump:teeny" task "tag" do helper.__send__(:tag_version) end
Version data entries
7 entries across 7 versions & 2 rubygems