diff options
-rw-r--r-- | lib/bundler/source/path/installer.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/bundler/source/path/installer.rb b/lib/bundler/source/path/installer.rb index 448a3b7c85..28e69875aa 100644 --- a/lib/bundler/source/path/installer.rb +++ b/lib/bundler/source/path/installer.rb @@ -5,7 +5,9 @@ module Bundler class Installer < Bundler::GemInstaller def initialize(spec, options = {}) @spec = spec - @bin_dir = Bundler.requires_sudo? ? "#{Bundler.tmp}/bin" : "#{Bundler.rubygems.gem_dir}/bin" + @tmp_bin_dir = "#{Bundler.tmp(spec.full_name)}/bin" + @gem_bin_dir = "#{Bundler.rubygems.gem_dir}/bin" + @bin_dir = Bundler.requires_sudo? ? @tmp_bin_dir : @gem_bin_dir @gem_dir = Bundler.rubygems.path(spec.full_gem_path) @wrappers = options[:wrappers] || true @env_shebang = options[:env_shebang] || true @@ -17,13 +19,15 @@ module Bundler return if spec.executables.nil? || spec.executables.empty? if Bundler.requires_sudo? - FileUtils.mkdir_p("#{Bundler.tmp}/bin") unless File.exist?("#{Bundler.tmp}/bin") + FileUtils.mkdir_p(@tmp_bin_dir) unless File.exist?(@tmp_bin_dir) end + super + if Bundler.requires_sudo? - Bundler.mkdir_p "#{Bundler.rubygems.gem_dir}/bin" + Bundler.mkdir_p @gem_bin_dir spec.executables.each do |exe| - Bundler.sudo "cp -R #{Bundler.tmp}/bin/#{exe} #{Bundler.rubygems.gem_dir}/bin/" + Bundler.sudo "cp -R #{@tmp_bin_dir}/#{exe} #{@gem_bin_dir}" end end end |