method
install_executables
v2_6_3 -
Show latest stable
-
0 notes -
Class: SetupCommand
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378
- 1_9_2_180
- 1_9_3_125 (0)
- 1_9_3_392 (0)
- 2_1_10 (0)
- 2_2_9 (0)
- 2_4_6 (0)
- 2_5_5 (0)
- 2_6_3 (0)
- What's this?
install_executables(bin_dir)
public
Hide source
# File lib/rubygems/commands/setup_command.rb, line 237 def install_executables(bin_dir) @bin_file_names = [] 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 -= ]update_rubygems bundler bundle_ruby] bin_files.each do |bin_file| bin_file_formatted = if options[:format_executable] Gem.default_exec_format % bin_file else bin_file end dest_file = File.join bin_dir, bin_file_formatted bin_tmp_file = File.join Dir.tmpdir, "#{bin_file}.#{$$}" begin bin = File.readlines bin_file bin[0] = shebang File.open bin_tmp_file, 'w' do |fp| fp.puts bin.join end install bin_tmp_file, dest_file, :mode => prog_mode @bin_file_names << dest_file ensure rm bin_tmp_file end next unless Gem.win_platform? begin bin_cmd_file = File.join Dir.tmpdir, "#{bin_file}.bat" File.open bin_cmd_file, 'w' do |file| file.puts @ECHO OFF IF NOT "%~f0" == "~f0" GOTO :WinNT @"#{File.basename(Gem.ruby).chomp('"')}" "#{dest_file}" %1 %2 %3 %4 %5 %6 %7 %8 %9 GOTO :EOF :WinNT @"#{File.basename(Gem.ruby).chomp('"')}" "%~dpn0" %* end install bin_cmd_file, "#{dest_file}.bat", :mode => prog_mode ensure rm bin_cmd_file end end end end end