lib/bundler.rb in bundler-1.1.pre.1 vs lib/bundler.rb in bundler-1.1.pre.2

- old
+ new

@@ -7,10 +7,11 @@ rescue LoadError end require 'yaml' require 'bundler/rubygems_ext' +require 'bundler/rubygems_integration' require 'bundler/version' module Bundler ORIGINAL_ENV = ENV.to_hash @@ -85,11 +86,10 @@ def ui @ui ||= UI.new end def bundle_path - # STDERR.puts settings.path @bundle_path ||= Pathname.new(settings.path).expand_path(root) end def bin_path @bin_path ||= begin @@ -138,15 +138,15 @@ Definition.build(default_gemfile, default_lockfile, unlock) end end def ruby_scope - "#{Gem.ruby_engine}/#{Gem::ConfigMap[:ruby_version]}" + "#{Bundler.rubygems.ruby_engine}/#{Gem::ConfigMap[:ruby_version]}" end def user_bundle_path - Pathname.new(Gem.user_home).join(".bundler") + Pathname.new(Bundler.rubygems.user_home).join(".bundler") end def home bundle_path.join("bundler") end @@ -200,11 +200,11 @@ def default_lockfile SharedHelpers.default_lockfile end def requires_sudo? - return @requires_sudo if @checked_for_sudo + return @requires_sudo if defined?(@checked_for_sudo) && @checked_for_sudo path = bundle_path path = path.parent until path.exist? sudo_present = !(`which sudo` rescue '').empty? @@ -259,17 +259,20 @@ def configure_gem_home_and_path if settings[:disable_shared_gems] ENV['GEM_PATH'] = '' ENV['GEM_HOME'] = File.expand_path(bundle_path, root) - elsif Gem.dir != bundle_path.to_s - paths = [Gem.dir, Gem.path].flatten.compact.uniq.reject{|p| p.empty? } + elsif Bundler.rubygems.gem_dir != bundle_path.to_s + possibles = [Bundler.rubygems.gem_dir, Bundler.rubygems.gem_path] + paths = possibles.flatten.compact.uniq.reject { |p| p.empty? } ENV["GEM_PATH"] = paths.join(File::PATH_SEPARATOR) ENV["GEM_HOME"] = bundle_path.to_s end - FileUtils.mkdir_p bundle_path.to_s - Gem.clear_paths + # TODO: This mkdir_p is only needed for JRuby <= 1.5 and should go away (GH #602) + FileUtils.mkdir_p bundle_path.to_s rescue nil + + Bundler.rubygems.clear_paths end def upgrade_lockfile lockfile = default_lockfile if lockfile.exist? && lockfile.read(3) == "---"