summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2012-08-26 00:42:42 -0700
committerAndre Arko <andre@arko.net>2012-08-26 00:42:42 -0700
commit92a9d2c6655e9c6f8a40c18a6a3bdc53d80db418 (patch)
tree0ef5ac9380ea4963216c4ac0dea874f5d1d14518 /lib
parentcb4926e940e7c65b5ade2cb31c472bfab9619883 (diff)
downloadbundler-92a9d2c6655e9c6f8a40c18a6a3bdc53d80db418.tar.gz
allow gemfile contents to be evaled from a string
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler/dsl.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb
index a76cd1baa8..b3a888494b 100644
--- a/lib/bundler/dsl.rb
+++ b/lib/bundler/dsl.rb
@@ -23,8 +23,9 @@ module Bundler
@ruby_version = nil
end
- def eval_gemfile(gemfile)
- instance_eval(Bundler.read_file(gemfile.to_s), gemfile.to_s, 1)
+ def eval_gemfile(gemfile, contents = nil)
+ contents ||= Bundler.read_file(gemfile.to_s)
+ instance_eval(contents, gemfile.to_s, 1)
rescue SyntaxError => e
bt = e.message.split("\n")[1..-1]
raise GemfileError, ["Gemfile syntax error:", *bt].join("\n")