Class: Gem::Commands::BumpCommand
- Inherits:
-
Gem::Command
- Object
- Gem::Command
- Gem::Commands::BumpCommand
- Defined in:
- lib/rubygems/commands/bump_command.rb
Constant Summary collapse
- BUMP_METHODS =
["major", "minor", "patch", "subpatch"]
Instance Method Summary collapse
- #arguments ⇒ Object
- #defaults_str ⇒ Object
- #execute ⇒ Object
-
#initialize ⇒ BumpCommand
constructor
A new instance of BumpCommand.
- #usage ⇒ Object
Constructor Details
#initialize ⇒ BumpCommand
Returns a new instance of BumpCommand.
4 5 6 |
# File 'lib/rubygems/commands/bump_command.rb', line 4 def initialize super("bump", "Increases the version of a .gemspec file") end |
Instance Method Details
#arguments ⇒ Object
12 13 14 15 16 17 |
# File 'lib/rubygems/commands/bump_command.rb', line 12 def arguments <<-ARGUMENTS METHOD version to update (#{BUMP_METHODS.join(", ")}) FILE name of the gemspec file (you can omit the .gemspec extension) ARGUMENTS end |
#defaults_str ⇒ Object
19 20 21 |
# File 'lib/rubygems/commands/bump_command.rb', line 19 def defaults_str "METHOD patch" end |
#execute ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/rubygems/commands/bump_command.rb', line 23 def execute bump_method = [:args][0] || "" gemspec = [:args][1] if BUMP_METHODS.include?(bump_method) unless gemspec_exists?(gemspec) puts "No gemspec name specified" show_help return end else unless gemspec_exists?(bump_method) if gemspec_exists?(gemspec) puts "Invalid bump method specified." else puts "Invalid gemspec name specified." end show_help return end gemspec = bump_method bump_method = "patch" end gemspec = gemspec_file(gemspec) scrape_gemspec(gemspec) bump_gemspec_version(bump_method) write_gemspec_file(gemspec) end |
#usage ⇒ Object
8 9 10 |
# File 'lib/rubygems/commands/bump_command.rb', line 8 def usage "#{program_name} [METHOD] FILE" end |