summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2016-09-13 14:01:29 +0200
committerSamuel Giddins <segiddins@segiddins.me>2016-09-13 14:01:29 +0200
commitd453033b19c27640f95cc085d52398342e15472b (patch)
tree37889b28613d27cee11f384fc225eab1c7df823c
parent695db9a169294ec0c6fef3c14ef0f0ac1f6cc65c (diff)
downloadbundler-d453033b19c27640f95cc085d52398342e15472b.tar.gz
[Path] Store lockfile paths relative to the root, not the gemfile path
-rw-r--r--lib/bundler/source/path.rb7
-rw-r--r--spec/install/gemfile/eval_gemfile_spec.rb18
2 files changed, 24 insertions, 1 deletions
diff --git a/lib/bundler/source/path.rb b/lib/bundler/source/path.rb
index 69bb0c1af2..4250e55905 100644
--- a/lib/bundler/source/path.rb
+++ b/lib/bundler/source/path.rb
@@ -46,7 +46,7 @@ module Bundler
def to_lock
out = String.new("PATH\n")
- out << " remote: #{relative_path}\n"
+ out << " remote: #{lockfile_path}\n"
out << " glob: #{@glob}\n" unless @glob == DEFAULT_GLOB
out << " specs:\n"
end
@@ -129,6 +129,11 @@ module Bundler
"`#{somepath}`.\nThe error message was: #{e.message}."
end
+ def lockfile_path
+ return path if path.absolute?
+ expand(path).relative_path_from(Bundler.root)
+ end
+
def app_cache_path(custom_path = nil)
@app_cache_path ||= Bundler.app_cache(custom_path).join(app_cache_dirname)
end
diff --git a/spec/install/gemfile/eval_gemfile_spec.rb b/spec/install/gemfile/eval_gemfile_spec.rb
index 2660ac98c2..29f27550e4 100644
--- a/spec/install/gemfile/eval_gemfile_spec.rb
+++ b/spec/install/gemfile/eval_gemfile_spec.rb
@@ -26,6 +26,24 @@ describe "bundle install with gemfile that uses eval_gemfile" do
end
end
+ context "eval-ed Gemfile has relative-path gems" do
+ before do
+ build_lib("a", :path => "gems/a")
+ create_file "nested/Gemfile-nested", <<-G
+ gem "a", :path => "../gems/a"
+ G
+
+ gemfile <<-G
+ eval_gemfile "nested/Gemfile-nested"
+ G
+ end
+
+ it "installs the path gem" do
+ bundle! :install
+ expect(the_bundle).to include_gem("a 1.0")
+ end
+ end
+
context "Gemfile uses gemspec paths after eval-ing a Gemfile" do
before { create_file "other/Gemfile-other" }