Sha256: 1ef144094e3bfb4689af8c5338c8165b9e30d5e8f2ec0ca0d5fe49f22dbfc8d3

Contents?: true

Size: 909 Bytes

Versions: 4

Compression:

Stored size: 909 Bytes

Contents

class << (helper = Bundler::GemHelper.instance)
  def update_gemspec
    path = gemspec.loaded_from
    File.open(path, "r+b") do |f|
      d = f.read
      if d.sub!(/^(_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 commit -m bump\ up\ to\ #{gemspec.version}
          #{gemspec.loaded_from}])
  end

  def version=(v)
    gemspec.version = v
    update_gemspec
    commit_bump
  end
end

major, minor, teeny = helper.gemspec.version.segments

task "bump:teeny" do
  helper.version = Gem::Version.new("#{major}.#{minor}.#{teeny+1}")
end

task "bump:minor" do
  helper.version = Gem::Version.new("#{major}.#{minor+1}.0")
end

task "bump:major" do
  helper.version = Gem::Version.new("#{major+1}.0.0")
end

task "bump" => "bump:teeny"

task "tag" do
  helper.__send__(:tag_version)
end

Version data entries

4 entries across 4 versions & 3 rubygems

Version Path
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/io-wait-0.2.1/rakelib/version.rake
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/io-wait-0.2.1/rakelib/version.rake
cgi-0.3.2 rakelib/version.rake
io-wait-0.2.1 rakelib/version.rake