diff options
author | Hiroshi SHIBATA <[email protected]> | 2019-12-13 20:19:08 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2019-12-13 20:19:33 +0900 |
commit | 82cc2843a92b286cc13afd0860a4e111d4ea2a0b (patch) | |
tree | a517dedd40d35540930cea7732f5a36e76a549e8 /lib/rubygems/commands/sources_command.rb | |
parent | 26774351dc5f494253ba031e4bc453dc4dddb2cf (diff) |
Prepare to release RubyGems 3.1.0 final version.
Diffstat (limited to 'lib/rubygems/commands/sources_command.rb')
-rw-r--r-- | lib/rubygems/commands/sources_command.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/rubygems/commands/sources_command.rb b/lib/rubygems/commands/sources_command.rb index af145fd7b4..feab23237d 100644 --- a/lib/rubygems/commands/sources_command.rb +++ b/lib/rubygems/commands/sources_command.rb @@ -43,6 +43,8 @@ class Gem::Commands::SourcesCommand < Gem::Command source = Gem::Source.new source_uri + check_typo_squatting(source) + begin if Gem.sources.include? source say "source #{source_uri} already present in the cache" @@ -62,6 +64,18 @@ class Gem::Commands::SourcesCommand < Gem::Command end end + def check_typo_squatting(source) + if source.typo_squatting?("rubygems.org") + question = <<-QUESTION.chomp +#{source.uri.to_s} is too similar to https://rubygems.org + +Do you want to add this source? + QUESTION + + terminate_interaction 1 unless ask_yes_no question + end + end + def check_rubygems_https(source_uri) # :nodoc: uri = URI source_uri |