Class: Gem::Commands::BumpCommand
- Inherits:
-
Gem::Command
- Object
- Gem::Command
- Gem::Commands::BumpCommand
- Includes:
- CommandOptions, Gem::Commands, GemRelease, Helpers
- Defined in:
- lib/rubygems/commands/bump_command.rb
Constant Summary collapse
- DEFAULTS =
{ :version => '', :commit => true, :push => false, :tag => false, :release => false, :key => '', :host => '', :quiet => false }
Constants included from GemRelease
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#usage ⇒ Object
readonly
Returns the value of attribute usage.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(options = {}) ⇒ BumpCommand
constructor
A new instance of BumpCommand.
Constructor Details
#initialize(options = {}) ⇒ BumpCommand
Returns a new instance of BumpCommand.
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rubygems/commands/bump_command.rb', line 22 def initialize( = {}) @name = 'bump' super @name, 'Bump the gem version', () option :version, '-v', 'Target version: next [major|minor|patch|pre|release] 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
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
9 10 11 |
# File 'lib/rubygems/commands/bump_command.rb', line 9 def arguments @arguments end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/rubygems/commands/bump_command.rb', line 9 def name @name end |
#usage ⇒ Object (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
#execute ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/rubygems/commands/bump_command.rb', line 36 def execute @new_version_number = nil tasks = [:commit, :push, :release, :tag] # enforce option dependencies [:push] = true if [:tag] [:commit] = [:commit] || [:push] || [:tag] || [:release] in_gemspec_dirs do run_cmd(:bump) end if @new_version_number == nil say "No version files could be found, so no actions were performed." unless quiet? else tasks.each do |task| run_cmd(task) if [task] end success end end |