Class: Rake::Gemcutter::GemcutterCommands

Inherits:
Gem::AbstractCommand
  • Object
show all
Defined in:
lib/rake/gemcutter.rb

Instance Method Summary collapse

Constructor Details

#initializeGemcutterCommands

Returns a new instance of GemcutterCommands.



7
8
# File 'lib/rake/gemcutter.rb', line 7

def initialize
end

Instance Method Details

#send_gem(gem_path) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/rake/gemcutter.rb', line 10

def send_gem(gem_path)
  puts "Pushing gem to Gemcutter..."

  response = make_request(:post, "gems") do |request|
    request.body = File.open(gem_path){|io| io.read }
    request.add_field("Content-Length", request.body.size)
    request.add_field("Content-Type", "application/octet-stream")
    request.add_field("Authorization", api_key)
  end

  puts response.body
end