lib/bundler.rb in bundler-1.2.5 vs lib/bundler.rb in bundler-1.3.0.pre

- old
+ new

@@ -1,10 +1,9 @@ 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 @@ -12,20 +11,22 @@ ORIGINAL_ENV = ENV.to_hash autoload :Definition, 'bundler/definition' autoload :Dependency, 'bundler/dependency' autoload :DepProxy, 'bundler/dep_proxy' + autoload :Deprecate, 'bundler/deprecate' autoload :Dsl, 'bundler/dsl' autoload :EndpointSpecification, 'bundler/endpoint_specification' autoload :Environment, 'bundler/environment' autoload :Fetcher, 'bundler/fetcher' autoload :GemHelper, 'bundler/gem_helper' autoload :GemHelpers, 'bundler/gem_helpers' autoload :GemInstaller, 'bundler/gem_installer' autoload :Graph, 'bundler/graph' autoload :Index, 'bundler/index' autoload :Installer, 'bundler/installer' + autoload :Injector, 'bundler/injector' autoload :LazySpecification, 'bundler/lazy_specification' autoload :LockfileParser, 'bundler/lockfile_parser' autoload :MatchPlatform, 'bundler/match_platform' autoload :RemoteSpecification, 'bundler/remote_specification' autoload :Resolver, 'bundler/resolver' @@ -43,24 +44,24 @@ def self.status_code(code) define_method(:status_code) { code } end end - class GemfileNotFound < BundlerError; status_code(10) ; end - class GemNotFound < BundlerError; status_code(7) ; end - class GemfileError < BundlerError; status_code(4) ; end - class InstallError < BundlerError; status_code(5) ; end - class InstallHookError < BundlerError; status_code(6) ; end - class PathError < BundlerError; status_code(13) ; end - class GitError < BundlerError; status_code(11) ; end - class DeprecatedError < BundlerError; status_code(12) ; end - class GemspecError < BundlerError; status_code(14) ; end - class DslError < BundlerError; status_code(15) ; end - class ProductionError < BundlerError; status_code(16) ; end - class InvalidOption < DslError ; end - class HTTPError < BundlerError; status_code(17) ; end - class RubyVersionMismatch < BundlerError; status_code(18) ; end + class GemfileNotFound < BundlerError; status_code(10) ; end + class GemNotFound < BundlerError; status_code(7) ; end + class GemfileError < BundlerError; status_code(4) ; end + class InstallError < BundlerError; status_code(5) ; end + class InstallHookError < BundlerError; status_code(6) ; end + class PathError < BundlerError; status_code(13) ; end + class GitError < BundlerError; status_code(11) ; end + class DeprecatedError < BundlerError; status_code(12) ; end + class GemspecError < BundlerError; status_code(14) ; end + class DslError < BundlerError; status_code(15) ; end + class ProductionError < BundlerError; status_code(16) ; end + class InvalidOption < DslError ; end + class HTTPError < BundlerError; status_code(17) ; end + class RubyVersionMismatch < BundlerError; status_code(18) ; end WINDOWS = RbConfig::CONFIG["host_os"] =~ %r!(msdos|mswin|djgpp|mingw)! FREEBSD = RbConfig::CONFIG["host_os"] =~ /bsd/ NULL = WINDOWS ? "NUL" : "/dev/null" @@ -97,13 +98,13 @@ # Returns absolute location of where binstubs are installed to. def bin_path @bin_path ||= begin path = settings[:bin] || "bin" - path = Pathname.new(path).expand_path(root).expand_path + path = Pathname.new(path).expand_path(root) FileUtils.mkdir_p(path) - path + Pathname.new(path).expand_path end end def setup(*groups) # Just return if all groups are already loaded @@ -288,15 +289,16 @@ def load_gemspec_uncached(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) - - if contents[0..2] == "---" # YAML header + if contents =~ /\A---/ # try YAML begin Gem::Specification.from_yaml(contents) - rescue ArgumentError, YamlSyntaxError, Gem::EndOfYAMLException, Gem::Exception + # Raises ArgumentError if the file is not valid YAML (on syck) + # Psych raises a Psych::SyntaxError + rescue YamlSyntaxError, ArgumentError, Gem::EndOfYAMLException, Gem::Exception eval_gemspec(path, contents) end else eval_gemspec(path, contents) end @@ -324,9 +326,10 @@ raise GemspecError, msg end def configure_gem_home_and_path blank_home = ENV['GEM_HOME'].nil? || ENV['GEM_HOME'].empty? + if settings[:disable_shared_gems] ENV['GEM_PATH'] = '' configure_gem_home elsif blank_home || Bundler.rubygems.gem_dir != bundle_path.to_s possibles = [Bundler.rubygems.gem_dir, Bundler.rubygems.gem_path]