Class: Gem::Commands::PushCommand
- Inherits:
-
AbstractCommand
- Object
- AbstractCommand
- Gem::Commands::PushCommand
- Defined in:
- lib/commands/push.rb
Instance Method Summary collapse
- #arguments ⇒ Object
- #description ⇒ Object
- #execute ⇒ Object
-
#initialize ⇒ PushCommand
constructor
A new instance of PushCommand.
- #send_gem ⇒ Object
- #usage ⇒ Object
Constructor Details
#initialize ⇒ PushCommand
Returns a new instance of PushCommand.
15 16 17 18 |
# File 'lib/commands/push.rb', line 15 def initialize super 'push', description add_proxy_option end |
Instance Method Details
#arguments ⇒ Object
7 8 9 |
# File 'lib/commands/push.rb', line 7 def arguments "GEM built gem to push up" end |
#description ⇒ Object
3 4 5 |
# File 'lib/commands/push.rb', line 3 def description 'Push a gem up to Gemcutter' end |
#execute ⇒ Object
20 21 22 23 |
# File 'lib/commands/push.rb', line 20 def execute setup send_gem end |
#send_gem ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/commands/push.rb', line 25 def send_gem say "Pushing gem to Gemcutter..." name = get_one_gem_name response = make_request(:post, "gems") do |request| request.body = File.open(name).read request.add_field("Content-Length", request.body.size) request.add_field("Content-Type", "application/octet-stream") request.add_field("Authorization", api_key) end say response.body end |
#usage ⇒ Object
11 12 13 |
# File 'lib/commands/push.rb', line 11 def usage "#{program_name} GEM" end |