diff options
author | James Wen <jrw2175@columbia.edu> | 2016-05-18 01:23:23 -0400 |
---|---|---|
committer | James Wen <jrw2175@columbia.edu> | 2016-05-18 12:55:43 -0400 |
commit | 28cdc880281a524480ebfb092349fd94fae3b436 (patch) | |
tree | 46cbf61c9229573142696c94d6c5805be7197a41 | |
parent | a95758f5139e7f7c8cdf100ddc8e590591110bd6 (diff) | |
download | bundler-28cdc880281a524480ebfb092349fd94fae3b436.tar.gz |
Restore original gemfile to `@gemfile` after nested `eval_gemfile`
-rw-r--r-- | lib/bundler/dsl.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb index b201e097c6..1a53e68db7 100644 --- a/lib/bundler/dsl.rb +++ b/lib/bundler/dsl.rb @@ -34,7 +34,9 @@ module Bundler end def eval_gemfile(gemfile, contents = nil) - @gemfile = Pathname.new(gemfile).expand_path + expanded_gemfile_path = Pathname.new(gemfile).expand_path + @gemfile = expanded_gemfile_path + original_gemfile = @gemfile contents ||= Bundler.read_file(gemfile.to_s) instance_eval(contents, gemfile.to_s, 1) rescue Exception => e @@ -43,6 +45,8 @@ module Bundler "`#{File.basename gemfile.to_s}`: #{e.message}" raise DSLError.new(message, gemfile, e.backtrace, contents) + ensure + @gemfile = original_gemfile end def gemspec(opts = nil) |