summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBundlerbot <bot@bundler.io>2019-04-26 16:22:47 +0000
committerBundlerbot <bot@bundler.io>2019-04-26 16:22:47 +0000
commit6f94959d3cc95bea616c40af7ed516b67dcbd5e0 (patch)
tree838b706bbdc1ab7fee87952475d39bedce4dbb0f
parent6b88a62f72e3dce6ef7f45117f457799113a1536 (diff)
parentc0f4d4ec55d590ba98cda54be3faf47bbb92af1b (diff)
downloadbundler-6f94959d3cc95bea616c40af7ed516b67dcbd5e0.tar.gz
Merge #7139
7139: Tweak rubygems integration r=deivid-rodriguez a=deivid-rodriguez ### What was the end-user problem that led to this PR? The problem was that the rubygems integration file could be more consistent. ### What is your fix for the problem, implemented in this PR? My fix is to lazily require `monitor`, just like it's done with the other requires in the file, and to define the methods that check the rubygems version a single time, just like the rest of the methods in the file. Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
-rw-r--r--lib/bundler/rubygems_integration.rb34
1 files changed, 12 insertions, 22 deletions
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb
index 32ddf185a0..81bac3540e 100644
--- a/lib/bundler/rubygems_integration.rb
+++ b/lib/bundler/rubygems_integration.rb
@@ -1,12 +1,12 @@
# frozen_string_literal: true
-require "monitor"
-
module Bundler
class RubygemsIntegration
if defined?(Gem::Ext::Builder::CHDIR_MONITOR)
EXT_LOCK = Gem::Ext::Builder::CHDIR_MONITOR
else
+ require "monitor"
+
EXT_LOCK = Monitor.new
end
@@ -304,27 +304,17 @@ module Bundler
end
end
- if provides?(">= 2.5.2")
- # RubyGems-generated binstubs call Kernel#gem
- def binstubs_call_gem?
- false
- end
-
- # only 2.5.2+ has all of the stub methods we want to use, and since this
- # is a performance optimization _only_,
- # we'll restrict ourselves to the most
- # recent RG versions instead of all versions that have stubs
- def stubs_provide_full_functionality?
- true
- end
- else
- def binstubs_call_gem?
- true
- end
+ # RubyGems-generated binstubs call Kernel#gem
+ def binstubs_call_gem?
+ !provides?(">= 2.5.2")
+ end
- def stubs_provide_full_functionality?
- false
- end
+ # only 2.5.2+ has all of the stub methods we want to use, and since this
+ # is a performance optimization _only_,
+ # we'll restrict ourselves to the most
+ # recent RG versions instead of all versions that have stubs
+ def stubs_provide_full_functionality?
+ provides?(">= 2.5.2")
end
def replace_gem(specs, specs_by_name)