Permalink
Browse files

Pass Gem::Specification.from_yaml a string containing the gemspec (in…

…stead of the filename)
  • Loading branch information...
1 parent 30319c6 commit f0e9ca3fc851e0bd858d3da64f86751a26db533a @sumbach sumbach committed with Andre Arko and Terence Lee Jan 19, 2011
Showing with 3 additions and 2 deletions.
  1. +3 −2 lib/bundler.rb
View
@@ -230,12 +230,13 @@ def load_gemspec(file)
path = Pathname.new(file)
# Eval the gemspec from its parent directory
Dir.chdir(path.dirname.to_s) do
+ contents = File.read(path.basename.to_s)
begin
- Gem::Specification.from_yaml(path.basename.to_s)
+ Gem::Specification.from_yaml(contents)
# Raises ArgumentError if the file is not valid YAML
rescue ArgumentError, SyntaxError, Gem::EndOfYAMLException, Gem::Exception
begin
- eval(File.read(path.basename.to_s), TOPLEVEL_BINDING, path.expand_path.to_s)
+ eval(contents, TOPLEVEL_BINDING, path.expand_path.to_s)
rescue LoadError => e
original_line = e.backtrace.find { |line| line.include?(path.to_s) }
msg = "There was a LoadError while evaluating #{path.basename}:\n #{e.message}"

0 comments on commit f0e9ca3

Please sign in to comment.