From 5335ce0e060c7a2a0b01c57f8f8a64254f2658e1 Mon Sep 17 00:00:00 2001 From: hsbt Date: Wed, 21 Nov 2018 10:20:47 +0000 Subject: Merge master branch from rubygems/rubygems upstream. * Enable Style/MethodDefParentheses in Rubocop https://github.com/rubygems/rubygems/pull/2478 * Enable Style/MultilineIfThen in Rubocop https://github.com/rubygems/rubygems/pull/2479 * Fix required_ruby_version with prereleases and improve error message https://github.com/rubygems/rubygems/pull/2344 * Fix bundler rubygems binstub not properly looking for bundler https://github.com/rubygems/rubygems/pull/2426 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rubygems/commands/sources_command.rb | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'lib/rubygems/commands/sources_command.rb') diff --git a/lib/rubygems/commands/sources_command.rb b/lib/rubygems/commands/sources_command.rb index 7e46963a4c..af145fd7b4 100644 --- a/lib/rubygems/commands/sources_command.rb +++ b/lib/rubygems/commands/sources_command.rb @@ -38,13 +38,13 @@ class Gem::Commands::SourcesCommand < Gem::Command add_proxy_option end - def add_source source_uri # :nodoc: + def add_source(source_uri) # :nodoc: check_rubygems_https source_uri source = Gem::Source.new source_uri begin - if Gem.sources.include? source then + if Gem.sources.include? source say "source #{source_uri} already present in the cache" else source.load_specs :released @@ -62,11 +62,11 @@ class Gem::Commands::SourcesCommand < Gem::Command end end - def check_rubygems_https source_uri # :nodoc: + def check_rubygems_https(source_uri) # :nodoc: uri = URI source_uri if uri.scheme and uri.scheme.downcase == 'http' and - uri.host.downcase == 'rubygems.org' then + uri.host.downcase == 'rubygems.org' question = <<-QUESTION.chomp https://rubygems.org is recommended for security over #{uri} @@ -81,10 +81,10 @@ Do you want to add this insecure source? path = Gem.spec_cache_dir FileUtils.rm_rf path - unless File.exist? path then + unless File.exist? path say "*** Removed specs cache ***" else - unless File.writable? path then + unless File.writable? path say "*** Unable to remove source cache (write protected) ***" else say "*** Unable to remove source cache ***" @@ -175,8 +175,8 @@ To remove a source use the --remove argument: list if list? end - def remove_source source_uri # :nodoc: - unless Gem.sources.include? source_uri then + def remove_source(source_uri) # :nodoc: + unless Gem.sources.include? source_uri say "source #{source_uri} not present in cache" else Gem.sources.delete source_uri @@ -195,12 +195,12 @@ To remove a source use the --remove argument: say "source cache successfully updated" end - def remove_cache_file desc, path # :nodoc: + def remove_cache_file(desc, path) # :nodoc: FileUtils.rm_rf path - if not File.exist?(path) then + if not File.exist?(path) say "*** Removed #{desc} source cache ***" - elsif not File.writable?(path) then + elsif not File.writable?(path) say "*** Unable to remove #{desc} source cache (write protected) ***" else say "*** Unable to remove #{desc} source cache ***" @@ -208,4 +208,3 @@ To remove a source use the --remove argument: end end - -- cgit v1.2.3