Sha256: 715aa4298bfc08bc4a2831e95e1dd54933a09e04ead1795b707428c3a182e090

Contents?: true

Size: 965 Bytes

Versions: 1

Compression:

Stored size: 965 Bytes

Contents

require 'core_ext/string/camelize'

class Gem::Commands::BumpCommand < Gem::Command
  include GemRelease
  include Helpers, CommandOptions

  attr_reader :arguments, :usage

  OPTIONS = { :to => :patch, :push => false }

  def initialize
    super 'bump', 'Bump the gem version', OPTIONS

    option :to,   '-t', 'Target version: next [major|minor|patch] or a given version number [x.x.x]'
    option :push, '-p', 'Push to origin (defaults to false)'
  end

  def execute
    bump
    commit
    push if options[:push]
  end
  
  protected

    def bump
      say "Bumping from #{version.old_number} to version #{version.new_number}"
      version.bump!
    end

    def commit
      say "Creating commit"
      `git add #{version.filename}`
      `git commit -m "Bump to #{version.new_number}"`
    end

    def push
      say "Pushing to origin"
      `git push`
    end
    
    def version
      @version ||= VersionFile.new(:target => options[:to])
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gem-release-0.0.13 lib/rubygems/commands/bump_command.rb