diff options
Diffstat (limited to 'lib/rubygems/commands/push_command.rb')
-rw-r--r-- | lib/rubygems/commands/push_command.rb | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/lib/rubygems/commands/push_command.rb b/lib/rubygems/commands/push_command.rb index 1864b4b095..591ddc3a80 100644 --- a/lib/rubygems/commands/push_command.rb +++ b/lib/rubygems/commands/push_command.rb @@ -1,8 +1,9 @@ # frozen_string_literal: true -require_relative '../command' -require_relative '../local_remote_options' -require_relative '../gemcutter_utilities' -require_relative '../package' + +require_relative "../command" +require_relative "../local_remote_options" +require_relative "../gemcutter_utilities" +require_relative "../package" class Gem::Commands::PushCommand < Gem::Command include Gem::LocalRemoteOptions @@ -29,7 +30,7 @@ The push command will use ~/.gem/credentials to authenticate to a server, but yo end def initialize - super 'push', 'Push a gem up to the gem server', :host => self.host + super "push", "Push a gem up to the gem server", host: host @user_defined_host = false @@ -37,9 +38,9 @@ The push command will use ~/.gem/credentials to authenticate to a server, but yo add_key_option add_otp_option - add_option('--host HOST', - 'Push to another gemcutter-compatible host', - ' (e.g. https://rubygems.org)') do |value, options| + add_option("--host HOST", + "Push to another gemcutter-compatible host", + " (e.g. https://rubygems.org)") do |value, options| options[:host] = value @user_defined_host = true end @@ -52,14 +53,14 @@ The push command will use ~/.gem/credentials to authenticate to a server, but yo default_gem_server, push_host = get_hosts_for(gem_name) @host = if @user_defined_host - options[:host] - elsif default_gem_server - default_gem_server - elsif push_host - push_host - else - options[:host] - end + options[:host] + elsif default_gem_server + default_gem_server + elsif push_host + push_host + else + options[:host] + end sign_in @host, scope: get_push_scope @@ -74,7 +75,7 @@ The push command will use ~/.gem/credentials to authenticate to a server, but yo @host ||= push_host # Always include @host, even if it's nil - args += [ @host, push_host ] + args += [@host, push_host] say "Pushing gem to #{@host || Gem.host}..." |