summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2017-04-06 20:58:12 -0500
committerSamuel Giddins <segiddins@segiddins.me>2017-04-07 12:03:15 -0500
commit425fc28bb8cf7254996b4c445e66cfab67c8543f (patch)
tree6839a5136e675aaacdeda40c417521cc61753021
parentaba5e40d174bd8127377718013b0f2fb78939d40 (diff)
downloadbundler-425fc28bb8cf7254996b4c445e66cfab67c8543f.tar.gz
[Git] Only use stub specs on 2.5.1+
-rw-r--r--lib/bundler/source/git.rb5
-rw-r--r--spec/runtime/require_spec.rb2
2 files changed, 5 insertions, 2 deletions
diff --git a/lib/bundler/source/git.rb b/lib/bundler/source/git.rb
index dd515166c2..1ddb30e715 100644
--- a/lib/bundler/source/git.rb
+++ b/lib/bundler/source/git.rb
@@ -304,7 +304,10 @@ module Bundler
# no-op, since we validate when re-serializing the gemspec
def validate_spec(_spec); end
- if defined?(::Gem::StubSpecification)
+ # only 2.5.1+ has this method for stub creation, 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
+ if Bundler.rubygems.provides?(">= 2.5.1")
def load_gemspec(file)
stub = Gem::StubSpecification.gemspec_stub(file, install_path.parent, install_path.parent)
stub.full_gem_path = Pathname.new(file).dirname.expand_path(root).to_s.untaint
diff --git a/spec/runtime/require_spec.rb b/spec/runtime/require_spec.rb
index c07f6344fd..5bf0321f41 100644
--- a/spec/runtime/require_spec.rb
+++ b/spec/runtime/require_spec.rb
@@ -384,7 +384,7 @@ RSpec.describe "Bundler.require" do
expect(out).to eq("WIN")
end
- it "does not load git gemspecs that are used", :rubygems => ">= 2.3" do
+ it "does not load git gemspecs that are used", :rubygems => ">= 2.5.1" do
build_git "foo"
install_gemfile! <<-G