Class: Gem::Commands::PublishCommand
- Inherits:
-
Gem::Command
- Object
- Gem::Command
- Gem::Commands::PublishCommand
- Defined in:
- lib/rubygems_plugin.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize ⇒ PublishCommand
constructor
A new instance of PublishCommand.
-
#usage ⇒ Object
:nodoc:.
Constructor Details
#initialize ⇒ PublishCommand
Returns a new instance of PublishCommand.
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/rubygems_plugin.rb', line 6 def initialize super "publish", "Automatically publish a gem if the version has been updated" defaults.merge! :gem_repository => "rubygems" add_option( "-r", "--repository", "Set the gem repository (rubygems or gemfury)", "Default: #{[:gem_repository]}") do |value, | [:gem_repository] = value end end |
Instance Method Details
#execute ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rubygems_plugin.rb', line 23 def execute [:args].each do |gemspec| Dir.chdir(File.dirname(gemspec)) do gem = GemPublisher.publish_if_updated(File.basename(gemspec), [:gem_repository]) if gem $stderr.puts "Published #{gem}" else $stderr.puts "Nothing to do for #{gemspec}" end end end end |
#usage ⇒ Object
:nodoc:
19 20 21 |
# File 'lib/rubygems_plugin.rb', line 19 def usage # :nodoc: "#{program_name} GEMFILE [GEMFILE ...]" end |