diff options
Diffstat (limited to 'lib/bundler/source/path/installer.rb')
| -rw-r--r-- | lib/bundler/source/path/installer.rb | 43 |
1 files changed, 11 insertions, 32 deletions
diff --git a/lib/bundler/source/path/installer.rb b/lib/bundler/source/path/installer.rb index a0357ffa39..39765e5da2 100644 --- a/lib/bundler/source/path/installer.rb +++ b/lib/bundler/source/path/installer.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require_relative "../../rubygems_gem_installer" + module Bundler class Source class Path @@ -16,47 +18,24 @@ module Bundler @build_args = options[:build_args] || Bundler.rubygems.build_args @gem_bin_dir = "#{Bundler.rubygems.gem_dir}/bin" @disable_extensions = options[:disable_extensions] - - if Bundler.requires_sudo? - @tmp_dir = Bundler.tmp(spec.full_name).to_s - @bin_dir = "#{@tmp_dir}/bin" - else - @bin_dir = @gem_bin_dir - end + @bin_dir = @gem_bin_dir end def post_install - SharedHelpers.chdir(@gem_dir) do - run_hooks(:pre_install) - - unless @disable_extensions - build_extensions - run_hooks(:post_build) - end - - generate_bin unless spec.executables.nil? || spec.executables.empty? + run_hooks(:pre_install) - run_hooks(:post_install) + unless @disable_extensions || Bundler.settings[:no_build_extension] + build_extensions + run_hooks(:post_build) end - ensure - Bundler.rm_rf(@tmp_dir) if Bundler.requires_sudo? - end - - private - def generate_bin - super + generate_bin unless spec.executables.empty? - if Bundler.requires_sudo? - SharedHelpers.filesystem_access(@gem_bin_dir) do |p| - Bundler.mkdir_p(p) - end - spec.executables.each do |exe| - Bundler.sudo "cp -R #{@bin_dir}/#{exe} #{@gem_bin_dir}" - end - end + run_hooks(:post_install) end + private + def run_hooks(type) hooks_meth = "#{type}_hooks" return unless Gem.respond_to?(hooks_meth) |
