1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/rubygems.rb, lib/rubygems/*, test/rubygems/*: Update rubygems-2.5.2.

It supports to enable frozen string literal and add `--norc` option for
  disable to `.gemrc` configuration.
  See 2.5.2 release notes for other fixes and enhancements.
  a8aa3bac72/History.txt (L3)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53707 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
hsbt 2016-02-01 12:43:26 +00:00
parent 94cfa2893c
commit a21d403f21
304 changed files with 966 additions and 624 deletions

View file

@ -1,4 +1,4 @@
# frozen_string_literal: false
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/local_remote_options'
require 'rubygems/version_option'
@ -32,7 +32,7 @@ as the reason for the removal request.
end
def usage # :nodoc:
"#{program_name} GEM -v VERSION [-p PLATFORM] [--undo] [--key KEY_NAME]"
"#{program_name} GEM -v VERSION [-p PLATFORM] [--key KEY_NAME] [--host HOST]"
end
def initialize
@ -41,25 +41,25 @@ as the reason for the removal request.
add_version_option("remove")
add_platform_option("remove")
add_option('--undo') do |value, options|
options[:undo] = true
add_option('--host HOST',
'Yank from another gemcutter-compatible host') do |value, options|
options[:host] = value
end
add_key_option
@host = nil
end
def execute
sign_in
@host = options[:host]
sign_in @host
version = get_version_from_requirements(options[:version])
platform = get_platform_from_requirements(options)
if version then
if options[:undo] then
unyank_gem(version, platform)
else
yank_gem(version, platform)
end
yank_gem(version, platform)
else
say "A version argument is required: #{usage}"
terminate_interaction
@ -71,16 +71,11 @@ as the reason for the removal request.
yank_api_request(:delete, version, platform, "api/v1/gems/yank")
end
def unyank_gem(version, platform)
say "Unyanking gem from #{host}..."
yank_api_request(:put, version, platform, "api/v1/gems/unyank")
end
private
def yank_api_request(method, version, platform, api)
name = get_one_gem_name
response = rubygems_api_request(method, api) do |request|
response = rubygems_api_request(method, api, host) do |request|
request.add_field("Authorization", api_key)
data = {