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 18 19 20 21 22 23 24 |
# 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( "-rREPOSITORY", "--repository=REPOSITORY", "Set the gem repository (rubygems or gemfury)", "Default: #{defaults[:gem_repository]}") do |value, | [:gem_repository] = value end add_option( "-aAS", "--as=AS", "Specify a shared account to publish the gem (gemfury only)" ) do |value, | [:as] = value end end |
Instance Method Details
#execute ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/rubygems_plugin.rb', line 30 def execute [:args].each do |gemspec| Dir.chdir(File.dirname(gemspec)) do new_opts = {} new_opts[:as] = [:as] if [:as] gem = GemPublisher.publish_if_updated(File.basename(gemspec), [:gem_repository], new_opts) if gem $stderr.puts "Published #{gem}" else $stderr.puts "Nothing to do for #{gemspec}" end end end end |
#usage ⇒ Object
:nodoc:
26 27 28 |
# File 'lib/rubygems_plugin.rb', line 26 def usage # :nodoc: "#{program_name} GEMFILE [GEMFILE ...]" end |