aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bundler/templates
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2010-03-17 15:34:18 -0700
committerAndre Arko <andre@arko.net>2010-03-17 15:34:18 -0700
commiteedbe7bbb512df55baeb7283ad56ab49b4a5aa2b (patch)
treeb192ec1b7baa28fe824463190f8937d5dfdbd4ee /lib/bundler/templates
parent5401ea1d612776c02f218ddd0c4e59c92aa428c0 (diff)
downloadbundler-eedbe7bbb512df55baeb7283ad56ab49b4a5aa2b.tar.gz
Eval locked specs in context of their directory, too
Diffstat (limited to 'lib/bundler/templates')
-rw-r--r--lib/bundler/templates/environment.erb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/bundler/templates/environment.erb b/lib/bundler/templates/environment.erb
index 260a9c22..8e4c3509 100644
--- a/lib/bundler/templates/environment.erb
+++ b/lib/bundler/templates/environment.erb
@@ -14,8 +14,12 @@ module Bundler
<%= spec.inspect %>,
<% end -%>
].map do |hash|
- source = hash[:loaded_from] ? File.read(hash[:loaded_from]) : hash[:virtual_spec]
- spec = eval(source, binding, hash[:loaded_from] || "<virtual spec for '#{hash[:name]}'>")
+ if hash[:loaded_from]
+ dir = File.dirname(hash[:loaded_from])
+ spec = Dir.chdir(dir){ eval(File.read(hash[:loaded_from]), binding, hash[:loaded_from]) }
+ else
+ spec = eval(hash[:virtual_spec], binding, "<virtual spec for '#{hash[:name]}'>")
+ end
spec.loaded_from = hash[:loaded_from]
spec.require_paths = hash[:load_paths]
spec