diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-21 10:20:47 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-21 10:20:47 +0000 |
commit | 5335ce0e060c7a2a0b01c57f8f8a64254f2658e1 (patch) | |
tree | c63321cb7c7c5c15454a79d81123c7188be2c51e /lib/rubygems/commands/sources_command.rb | |
parent | 2f023c5dbaadede9ceac3eb9ac0e73f3050e5ada (diff) |
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
Diffstat (limited to 'lib/rubygems/commands/sources_command.rb')
-rw-r--r-- | lib/rubygems/commands/sources_command.rb | 23 |
1 files changed, 11 insertions, 12 deletions
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 - |