diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2021-12-24 09:32:59 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2021-12-24 10:35:31 +0900 |
commit | b0ad6cb371747a04eb12580e74c73179173cc89d (patch) | |
tree | ee873d5c682c4665c838e3ea43585536229a5509 /lib/rubygems | |
parent | de0523feddf740d28fe772f3a22ff9907f88bf69 (diff) |
Merge RubyGems-3.3.2 and Bundler-2.3.2
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5334
Diffstat (limited to 'lib/rubygems')
-rw-r--r-- | lib/rubygems/exceptions.rb | 10 | ||||
-rw-r--r-- | lib/rubygems/specification.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/stub_specification.rb | 2 |
3 files changed, 9 insertions, 5 deletions
diff --git a/lib/rubygems/exceptions.rb b/lib/rubygems/exceptions.rb index 20e4049e48..1806869098 100644 --- a/lib/rubygems/exceptions.rb +++ b/lib/rubygems/exceptions.rb @@ -24,10 +24,14 @@ class Gem::UnknownCommandError < Gem::Exception return if defined?(@attached) if defined?(DidYouMean::SPELL_CHECKERS) && defined?(DidYouMean::Correctable) - DidYouMean::SPELL_CHECKERS['Gem::UnknownCommandError'] = - Gem::UnknownCommandSpellChecker + if DidYouMean.respond_to?(:correct_error) + DidYouMean.correct_error(Gem::UnknownCommandError, Gem::UnknownCommandSpellChecker) + else + DidYouMean::SPELL_CHECKERS['Gem::UnknownCommandError'] = + Gem::UnknownCommandSpellChecker - prepend DidYouMean::Correctable + prepend DidYouMean::Correctable + end end @attached = true diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb index f162eb4a84..031a37f775 100644 --- a/lib/rubygems/specification.rb +++ b/lib/rubygems/specification.rb @@ -1116,7 +1116,7 @@ class Gem::Specification < Gem::BasicSpecification file = file.dup.tap(&Gem::UNTAINT) return unless File.file?(file) - code = File.read file, :mode => 'r:UTF-8:-' + code = Gem.open_with_flock(file, 'r:UTF-8:-', &:read) code.tap(&Gem::UNTAINT) diff --git a/lib/rubygems/stub_specification.rb b/lib/rubygems/stub_specification.rb index 4246f9de86..47fe7da695 100644 --- a/lib/rubygems/stub_specification.rb +++ b/lib/rubygems/stub_specification.rb @@ -110,7 +110,7 @@ class Gem::StubSpecification < Gem::BasicSpecification begin saved_lineno = $. - File.open loaded_from, OPEN_MODE do |file| + Gem.open_with_flock loaded_from, OPEN_MODE do |file| begin file.readline # discard encoding line stubline = file.readline.chomp |