summaryrefslogtreecommitdiff
path: root/lib/rubygems/commands/yank_command.rb
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-08-24 15:28:23 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-08-24 15:28:23 +0000
commit996b1bfa95347e5171c3f7ab32b6740656ed7a8b (patch)
treebe0310be446bf313f16a12a3a3b56c30b4900cbd /lib/rubygems/commands/yank_command.rb
parentce8729feb61d507805d965c5479f343e3701c659 (diff)
merge revision(s) 53707,53708,53709,53712,53777,53781: [Backport #12326]
* 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. https://github.com/rubygems/rubygems/blob/a8aa3bac723f045c52471c7b9328310a048561e0/History.txt#L3 * lib/rubygems/specification.rb: `coding` is affect only first line except shebang. * lib/rubygems/package.rb, lib/rubygems/package/*: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@56003 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/commands/yank_command.rb')
-rw-r--r--lib/rubygems/commands/yank_command.rb27
1 files changed, 11 insertions, 16 deletions
diff --git a/lib/rubygems/commands/yank_command.rb b/lib/rubygems/commands/yank_command.rb
index ec99bd7df6..0d6575b272 100644
--- a/lib/rubygems/commands/yank_command.rb
+++ b/lib/rubygems/commands/yank_command.rb
@@ -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 = {