From 7e417e943f741e99f17a6aa727605412966eea05 Mon Sep 17 00:00:00 2001 From: Andre Arko Date: Mon, 31 Mar 2014 15:24:06 +0800 Subject: per-gem tmp, copy EVERYTHING rubygems installed --- lib/bundler/fetcher.rb | 4 ++-- lib/bundler/source/rubygems.rb | 13 +++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/bundler/fetcher.rb b/lib/bundler/fetcher.rb index be11e3680e..e503fa2c0d 100644 --- a/lib/bundler/fetcher.rb +++ b/lib/bundler/fetcher.rb @@ -54,7 +54,7 @@ module Bundler def download_gem_from_uri(spec, uri) spec.fetch_platform - download_path = Bundler.requires_sudo? ? Bundler.tmp : Bundler.rubygems.gem_dir + download_path = Bundler.requires_sudo? ? Bundler.tmp(spec.full_name) : Bundler.rubygems.gem_dir gem_path = "#{Bundler.rubygems.gem_dir}/cache/#{spec.full_name}.gem" FileUtils.mkdir_p("#{download_path}/cache") @@ -62,7 +62,7 @@ module Bundler if Bundler.requires_sudo? Bundler.mkdir_p "#{Bundler.rubygems.gem_dir}/cache" - Bundler.sudo "mv #{Bundler.tmp}/cache/#{spec.full_name}.gem #{gem_path}" + Bundler.sudo "mv #{Bundler.tmp(spec.full_name)}/cache/#{spec.full_name}.gem #{gem_path}" end gem_path diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb index c4a5849fa8..02367fa7f1 100644 --- a/lib/bundler/source/rubygems.rb +++ b/lib/bundler/source/rubygems.rb @@ -79,7 +79,7 @@ module Bundler path = cached_gem(spec) if Bundler.requires_sudo? - install_path = Bundler.tmp + install_path = Bundler.tmp(spec.full_name) bin_path = install_path.join("bin") else install_path = Bundler.rubygems.gem_dir @@ -99,13 +99,14 @@ module Bundler # SUDO HAX if Bundler.requires_sudo? - Bundler.mkdir_p "#{Bundler.rubygems.gem_dir}/gems" - Bundler.mkdir_p "#{Bundler.rubygems.gem_dir}/specifications" - Bundler.sudo "cp -R #{Bundler.tmp}/gems/#{spec.full_name} #{Bundler.rubygems.gem_dir}/gems/" - Bundler.sudo "cp -R #{Bundler.tmp}/specifications/#{spec.full_name}.gemspec #{Bundler.rubygems.gem_dir}/specifications/" + Gem::REPOSITORY_SUBDIRECTORIES.each do |name| + Bundler.mkdir_p File.join(Bundler.rubygems.gem_dir, name) + Bundler.sudo "cp -R #{install_path}/#{name}/* #{Bundler.rubygems.gem_dir}/#{name}/" + end + spec.executables.each do |exe| Bundler.mkdir_p Bundler.system_bindir - Bundler.sudo "cp -R #{Bundler.tmp}/bin/#{exe} #{Bundler.system_bindir}" + Bundler.sudo "cp -R #{install_path}/bin/#{exe} #{Bundler.system_bindir}/" end end installed_spec.loaded_from = "#{Bundler.rubygems.gem_dir}/specifications/#{spec.full_name}.gemspec" -- cgit v1.2.1