summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Nadeau <julian@jnadeau.ca>2017-04-18 15:56:56 -0400
committerJulian Nadeau <julian@jnadeau.ca>2017-04-18 19:57:07 -0400
commitf89408c10294749c3b1c83bc4da733aa3b546866 (patch)
tree42e9ed50498320edf6dfb294210c82033d2a9ff5
parentf153ef72f8572eee86e8b1672e29a6a206efb91a (diff)
downloadbundler-f89408c10294749c3b1c83bc4da733aa3b546866.tar.gz
Apply source to calculate stub spec extension
-rw-r--r--lib/bundler/stub_specification.rb12
-rw-r--r--spec/install/gemfile/git_spec.rb5
2 files changed, 17 insertions, 0 deletions
diff --git a/lib/bundler/stub_specification.rb b/lib/bundler/stub_specification.rb
index 257a472224..c0a8d92252 100644
--- a/lib/bundler/stub_specification.rb
+++ b/lib/bundler/stub_specification.rb
@@ -11,6 +11,18 @@ module Bundler
attr_accessor :stub, :ignored
+ def source=(source)
+ super
+ # Stub has no concept of source, which means that extension_dir may be wrong
+ # This is the case for git-based gems. So, instead manually assign the extension dir
+ if source.respond_to?(:extension_dir_name)
+ path = File.join(stub.extensions_dir, source.extension_dir_name)
+ stub.extension_dir = File.expand_path(path)
+ else
+ stub.extension_dir = nil
+ end
+ end
+
def to_yaml
_remote_specification.to_yaml
end
diff --git a/spec/install/gemfile/git_spec.rb b/spec/install/gemfile/git_spec.rb
index d2d46279aa..8843fb7ebb 100644
--- a/spec/install/gemfile/git_spec.rb
+++ b/spec/install/gemfile/git_spec.rb
@@ -1030,6 +1030,11 @@ RSpec.describe "bundle install with git sources" do
puts FOO
R
expect(out).to eq("YES")
+
+ run! <<-R
+ puts $:.grep(/ext/)
+ R
+ expect(out).to eq(Pathname.glob(system_gem_path("bundler/gems/extensions/**/foo-1.0-*")).first.to_s)
end
it "does not use old extension after ref changes" do