summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonnie Tognazzini <donnie.tognazzini@appfolio.com>2016-01-27 13:12:33 -0800
committerDonnie Tognazzini <donnie.tognazzini@appfolio.com>2016-01-27 14:48:23 -0800
commit505b95d7bde10660134588e1a21668416621fa3d (patch)
tree36b80dc5df84b4bd945da1ba33140be4e36c1556
parent9963054247e6592e15f2ca9972a2f2843cd491b5 (diff)
downloadbundler-505b95d7bde10660134588e1a21668416621fa3d.tar.gz
Make all paths be relative to Gemfile during evaluation.
-rw-r--r--lib/bundler/dsl.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb
index 3308f85bbb..bc97d9fb62 100644
--- a/lib/bundler/dsl.rb
+++ b/lib/bundler/dsl.rb
@@ -49,8 +49,7 @@ module Bundler
glob = opts && opts[:glob]
name = opts && opts[:name] || "{,*}"
development_group = opts && opts[:development_group] || :development
- gemfile = @gemfile || Bundler.default_gemfile
- expanded_path = File.expand_path(path, gemfile.dirname)
+ expanded_path = path_relative_to_gemfile(path)
gemspecs = Dir[File.join(expanded_path, "#{name}.gemspec")]
@@ -147,7 +146,7 @@ module Bundler
end
def path(path, options = {}, &blk)
- with_source(@sources.add_path_source(normalize_hash(options).merge("path" => Pathname.new(path))), &blk)
+ with_source(@sources.add_path_source(normalize_hash(options).merge("path" => path_relative_to_gemfile(path))), &blk)
end
def git(uri, options = {}, &blk)
@@ -316,6 +315,10 @@ module Bundler
opts["git"] = @git_sources[git_name].call(opts[git_name])
end
+ if opts.key?("path")
+ opts["path"] = path_relative_to_gemfile(opts["path"])
+ end
+
%w(git path).each do |type|
next unless param = opts[type]
if version.first && version.first =~ /^\s*=?\s*(\d[^\s]*)\s*$/
@@ -490,5 +493,10 @@ module Bundler
[trace_line, description]
end
end
+
+ def path_relative_to_gemfile(path)
+ @gemfile ||= Bundler.default_gemfile
+ @gemfile.dirname + path
+ end
end
end