Method: Gem::Commands::NexusCommand#send_gem

Defined in:
lib/commands/nexus.rb

#send_gemObject



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/commands/nexus.rb', line 101

def send_gem
  say "Uploading gem to Nexus..."

  path = get_one_gem_name

  response = make_request(:put, "gems/#{File.basename(path)}") do |request|
    request.body = Gem.read_binary(path)
    request.add_field("Content-Length", request.body.size)
    request.add_field("Content-Type", "application/octet-stream")
    request.add_field("Authorization", authorization.strip) if authorization
  end

  case response.code
  when "401"
    say "Unauthorized"
  when "400"
    say "something went wrong - maybe (re)deployment is not allowed"
  when "500"
    say "something went wrong"
  else
    say response.message
  end
end