diff options
Diffstat (limited to 'lib/rubygems/commands/yank_command.rb')
-rw-r--r-- | lib/rubygems/commands/yank_command.rb | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/lib/rubygems/commands/yank_command.rb b/lib/rubygems/commands/yank_command.rb index cad78aec5f..fbdc262549 100644 --- a/lib/rubygems/commands/yank_command.rb +++ b/lib/rubygems/commands/yank_command.rb @@ -1,8 +1,9 @@ # frozen_string_literal: true -require_relative '../command' -require_relative '../local_remote_options' -require_relative '../version_option' -require_relative '../gemcutter_utilities' + +require_relative "../command" +require_relative "../local_remote_options" +require_relative "../version_option" +require_relative "../gemcutter_utilities" class Gem::Commands::YankCommand < Gem::Command include Gem::LocalRemoteOptions @@ -28,15 +29,15 @@ data you will need to change them immediately and yank your gem. end def initialize - super 'yank', 'Remove a pushed gem from the index' + super "yank", "Remove a pushed gem from the index" add_version_option("remove") add_platform_option("remove") add_otp_option - add_option('--host HOST', - 'Yank from another gemcutter-compatible host', - ' (e.g. https://rubygems.org)') do |value, options| + add_option("--host HOST", + "Yank from another gemcutter-compatible host", + " (e.g. https://rubygems.org)") do |value, options| options[:host] = value end @@ -61,7 +62,7 @@ data you will need to change them immediately and yank your gem. end def yank_gem(version, platform) - say "Yanking gem from #{self.host}..." + say "Yanking gem from #{host}..." args = [:delete, version, platform, "api/v1/gems/yank"] response = yank_api_request(*args) @@ -76,10 +77,10 @@ data you will need to change them immediately and yank your gem. request.add_field("Authorization", api_key) data = { - 'gem_name' => name, - 'version' => version, + "gem_name" => name, + "version" => version, } - data['platform'] = platform if platform + data["platform"] = platform if platform request.set_form_data data end @@ -88,7 +89,7 @@ data you will need to change them immediately and yank your gem. def get_version_from_requirements(requirements) requirements.requirements.first[1].version - rescue + rescue StandardError nil end |