lib/bundler.rb in bundler-1.1.pre vs lib/bundler.rb in bundler-1.1.pre.1
- old
+ new
@@ -1,8 +1,14 @@
require 'rbconfig'
require 'fileutils'
require 'pathname'
+
+begin
+ require 'psych'
+rescue LoadError
+end
+
require 'yaml'
require 'bundler/rubygems_ext'
require 'bundler/version'
module Bundler
@@ -224,15 +230,16 @@
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}"
msg << " from\n #{original_line}" if original_line
msg << "\n"