Navigation Menu

Skip to content

Commit

Permalink
Let default installer take care of bundler bins
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez committed Mar 19, 2019
1 parent fd5cb65 commit 01892ef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions lib/rubygems/commands/setup_command.rb
Expand Up @@ -165,7 +165,7 @@ def execute

remove_old_lib_files lib_dir

install_default_bundler_gem
install_default_bundler_gem bin_dir

if mode = options[:dir_mode]
@mkdirs.uniq!
Expand Down Expand Up @@ -240,14 +240,13 @@ def install_executables(bin_dir)
prog_mode = options[:prog_mode] || 0755

executables = { 'gem' => 'bin' }
executables['bundler'] = 'bundler/exe' if Gem::USE_BUNDLER_FOR_GEMDEPS
executables.each do |tool, path|
say "Installing #{tool} executable" if @verbose

Dir.chdir path do
bin_files = Dir['*']

bin_files -= %w[update_rubygems bundler bundle_ruby]
bin_files -= %w[update_rubygems]

bin_files.each do |bin_file|
bin_file_formatted = if options[:format_executable]
Expand Down Expand Up @@ -382,7 +381,7 @@ def fake_spec.full_gem_path
return false
end

def install_default_bundler_gem
def install_default_bundler_gem(bin_dir)
return unless Gem::USE_BUNDLER_FOR_GEMDEPS

specs_dir = Gem::Specification.default_specifications_dir
Expand Down Expand Up @@ -431,7 +430,7 @@ def install_default_bundler_gem

Dir.chdir("bundler") do
built_gem = Gem::Package.build(bundler_spec)
installer = Gem::Installer.at(built_gem, env_shebang: options[:env_shebang], install_as_default: true)
installer = Gem::Installer.at(built_gem, env_shebang: options[:env_shebang], install_as_default: true, bin_dir: bin_dir, wrappers: true)
installer.install
end

Expand Down
2 changes: 1 addition & 1 deletion test/rubygems/test_gem_commands_setup_command.rb
Expand Up @@ -187,7 +187,7 @@ def test_install_default_bundler_gem
@cmd.extend FileUtils

bin_dir = File.join(@gemhome, 'bin')
@cmd.install_default_bundler_gem
@cmd.install_default_bundler_gem bin_dir

bundler_spec = Gem::Specification.load("bundler/bundler.gemspec")
default_spec_path = File.join(Gem::Specification.default_specifications_dir, "#{bundler_spec.full_name}.gemspec")
Expand Down

0 comments on commit 01892ef

Please sign in to comment.