mirror of
https://github.com/ruby/ruby.git
synced 2025-08-24 21:44:30 +02:00
Prepare to release RubyGems 3.1.0 final version.
This commit is contained in:
parent
26774351dc
commit
82cc2843a9
23 changed files with 393 additions and 142 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue