From b3f692588b75451d4260f90db7fac46461569e87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Tue, 23 Apr 2019 18:27:33 +0200 Subject: Move require to the place where it's needed --- lib/bundler/rubygems_integration.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb index 32ddf185a0..6dea944e83 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 -- cgit v1.2.1 From c0f4d4ec55d590ba98cda54be3faf47bbb92af1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Tue, 23 Apr 2019 18:31:48 +0200 Subject: Simplify rubygems integration --- lib/bundler/rubygems_integration.rb | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb index 6dea944e83..81bac3540e 100644 --- a/lib/bundler/rubygems_integration.rb +++ b/lib/bundler/rubygems_integration.rb @@ -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) -- cgit v1.2.1