Class: Gem::Commands::BumpCommand

Inherits:
Gem::Command
  • Object
show all
Includes:
CommandOptions, Gem::Commands, GemRelease, Helpers
Defined in:
lib/rubygems/commands/bump_command.rb

Constant Summary collapse

DEFAULTS =
{
  :version  => 'patch',
  :commit   => true,
  :push     => false,
  :tag      => false,
  :release  => false,
  :key      => '',
  :host     => '',
  :quiet    => false
}

Constants included from GemRelease

GemRelease::VERSION

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ BumpCommand

Returns a new instance of BumpCommand.



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/rubygems/commands/bump_command.rb', line 22

def initialize(options = {})
  super 'bump', 'Bump the gem version', DEFAULTS.merge(options)

  option :version, '-v', 'Target version: next [major|minor|patch] or a given version number [x.x.x]'
  option :commit,  '-c', 'Perform a commit after incrementing gem version'
  option :push,    '-p', 'Push to the origin git repository'
  option :tag,     '-t', 'Create a git tag and push --tags to origin'
  option :release, '-r', 'Build gem from a gemspec and push to rubygems.org'
  option :key,     '-k', 'When releasing: Use the given API key from ~/.gem/credentials'
  option :host,    '-h', 'When releasing: Push to a gemcutter-compatible host other than rubygems.org'
  option :quiet,   '-q', 'Do not output status messages'
end

Instance Attribute Details

#argumentsObject (readonly)

Returns the value of attribute arguments.



9
10
11
# File 'lib/rubygems/commands/bump_command.rb', line 9

def arguments
  @arguments
end

#usageObject (readonly)

Returns the value of attribute usage.



9
10
11
# File 'lib/rubygems/commands/bump_command.rb', line 9

def usage
  @usage
end

Instance Method Details

#executeObject



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/rubygems/commands/bump_command.rb', line 35

def execute
  @new_version_number = nil

  # enforce option dependencies
  options[:push] = false if options[:tag] # push is performed as part of tag
  options[:commit] = options[:commit] || options[:push] || options[:tag] || options[:release]

  in_gemspec_dirs do
    bump
  end

  if @new_version_number == nil
    say "No version files could be found, so no actions were performed." unless quiet?
  else
    commit  if options[:commit]
    push    if options[:push]
    tag     if options[:tag]
    release if options[:release]
  end
end