lib/bundler.rb in bundler-1.2.0.pre.1 vs lib/bundler.rb in bundler-1.2.0.rc
- old
+ new
@@ -1,14 +1,16 @@
require 'rbconfig'
require 'fileutils'
require 'pathname'
+require 'bundler/gem_path_manipulation'
require 'bundler/psyched_yaml'
require 'bundler/rubygems_ext'
require 'bundler/rubygems_integration'
require 'bundler/version'
module Bundler
+ preserve_gem_path
ORIGINAL_ENV = ENV.to_hash
autoload :Definition, 'bundler/definition'
autoload :Dependency, 'bundler/dependency'
autoload :DepProxy, 'bundler/dep_proxy'
@@ -256,11 +258,11 @@
end
def which(executable)
if File.executable?(executable)
executable
- else
+ elsif ENV['PATH']
path = ENV['PATH'].split(File::PATH_SEPARATOR).find do |p|
File.executable?(File.join(p, executable))
end
path && File.expand_path(executable, path)
end
@@ -292,17 +294,17 @@
Gem::Specification.from_yaml(contents)
# Raises ArgumentError if the file is not valid YAML
rescue ArgumentError, SyntaxError, Gem::EndOfYAMLException, Gem::Exception
begin
eval(contents, TOPLEVEL_BINDING, path.expand_path.to_s)
- rescue LoadError => e
+ rescue LoadError, SyntaxError => 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 = "There was a #{e.class} while evaluating #{path.basename}: \n#{e.message}"
msg << " from\n #{original_line}" if original_line
msg << "\n"
- if RUBY_VERSION >= "1.9"
- msg << "\nDoes it try to require a relative path? That doesn't work in Ruby 1.9."
+ if e.is_a?(LoadError) && RUBY_VERSION >= "1.9"
+ msg << "\nDoes it try to require a relative path? That's been removed in Ruby 1.9."
end
raise GemspecError, msg
end
end