diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-09-28 01:16:43 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-09-28 01:16:43 +0000 |
commit | b6139464f544ec511f741f5bbae2fb13adc51c21 (patch) | |
tree | 00e91ff57caed712ae08e8b657e8e0a52a030d7c /lib/rubygems/commands/setup_command.rb | |
parent | 69934aeb8d7948c4ca590b7092504c41d8bce6ac (diff) |
rubygems 2.6.7
* lib/rubygems.rb, lib/rubygems/*, test/rubygems/*: Update
rubygems to 2.6.7, not the master, with r56225.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56278 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/commands/setup_command.rb')
-rw-r--r-- | lib/rubygems/commands/setup_command.rb | 159 |
1 files changed, 65 insertions, 94 deletions
diff --git a/lib/rubygems/commands/setup_command.rb b/lib/rubygems/commands/setup_command.rb index 1fff2a7dcb..ebb08d24d7 100644 --- a/lib/rubygems/commands/setup_command.rb +++ b/lib/rubygems/commands/setup_command.rb @@ -142,8 +142,6 @@ By default, this RubyGems will install gem as: remove_old_lib_files lib_dir - install_default_gemspec - say "RubyGems #{Gem::VERSION} installed" uninstall_old_gemcutter @@ -204,65 +202,59 @@ By default, this RubyGems will install gem as: end end - def install_executables(bin_dir) + say "Installing gem executable" if @verbose + @bin_file_names = [] - { - 'gem' => 'bin', - 'bundler' => 'bundler/exe', - }.each do |tool, path| - say "Installing #{tool} executable" if @verbose + Dir.chdir 'bin' do + bin_files = Dir['*'] + + bin_files.delete 'update_rubygems' + + bin_files.each do |bin_file| + bin_file_formatted = if options[:format_executable] then + Gem.default_exec_format % bin_file + else + bin_file + end - Dir.chdir path do - bin_files = Dir['*'] + dest_file = File.join bin_dir, bin_file_formatted + bin_tmp_file = File.join Dir.tmpdir, "#{bin_file}.#{$$}" - bin_files -= %w[update_rubygems bundler bundle_ruby] + begin + bin = File.readlines bin_file + bin[0] = "#!#{Gem.ruby}\n" - bin_files.each do |bin_file| - bin_file_formatted = if options[:format_executable] then - Gem.default_exec_format % bin_file - else - bin_file - end + File.open bin_tmp_file, 'w' do |fp| + fp.puts bin.join + end - dest_file = File.join bin_dir, bin_file_formatted - bin_tmp_file = File.join Dir.tmpdir, "#{bin_file}.#{$$}" + install bin_tmp_file, dest_file, :mode => 0755 + @bin_file_names << dest_file + ensure + rm bin_tmp_file + end - begin - bin = File.readlines bin_file - bin[0] = "#!#{Gem.ruby}\n" + next unless Gem.win_platform? - File.open bin_tmp_file, 'w' do |fp| - fp.puts bin.join - end + begin + bin_cmd_file = File.join Dir.tmpdir, "#{bin_file}.bat" - install bin_tmp_file, dest_file, :mode => 0755 - @bin_file_names << dest_file - ensure - rm bin_tmp_file + File.open bin_cmd_file, 'w' do |file| + file.puts <<-TEXT +@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" %* +TEXT 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 <<-TEXT - @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" %* - TEXT - end - - install bin_cmd_file, "#{dest_file}.bat", :mode => 0755 - ensure - rm bin_cmd_file - end + install bin_cmd_file, "#{dest_file}.bat", :mode => 0755 + ensure + rm bin_cmd_file end end end @@ -277,23 +269,18 @@ By default, this RubyGems will install gem as: end def install_lib(lib_dir) - { - 'RubyGems' => 'lib', - 'Bundler' => 'bundler/lib' - }.each do |tool, path| - say "Installing #{tool}" if @verbose - - lib_files = rb_files_in path - pem_files = pem_files_in path - - Dir.chdir path do - lib_files.each do |lib_file| - install_file lib_file, lib_dir - end + say "Installing RubyGems" if @verbose - pem_files.each do |pem_file| - install_file pem_file, lib_dir - end + lib_files = rb_files_in 'lib' + pem_files = pem_files_in 'lib' + + Dir.chdir 'lib' do + lib_files.each do |lib_file| + install_file lib_file, lib_dir + end + + pem_files.each do |pem_file| + install_file pem_file, lib_dir end end end @@ -339,19 +326,6 @@ By default, this RubyGems will install gem as: return false end - def install_default_gemspec - Dir.chdir("bundler") do - bundler_spec = Gem::Specification.load("bundler.gemspec") - bundler_spec.files = Dir["{*.md,{lib,exe,man}/**/*}"] - bundler_spec.executables -= %w[bundler bundle_ruby] - Dir.entries(Gem::Specification.default_specifications_dir). - select {|gs| gs.start_with?("bundler-") }. - each {|gs| File.delete(File.join(Gem::Specification.default_specifications_dir, gs)) } - default_spec_path = File.join(Gem::Specification.default_specifications_dir, "#{bundler_spec.full_name}.gemspec") - Gem.write_binary(default_spec_path, bundler_spec.to_ruby) - end - end - def make_destination_dirs(install_destdir) lib_dir, bin_dir = Gem.default_rubygems_dirs @@ -442,27 +416,23 @@ abort "#{deprecation_message}" end def remove_old_lib_files lib_dir - { - File.join(lib_dir, 'rubygems') => 'lib/rubygems', - File.join(lib_dir, 'bundler') => 'bundler/lib/bundler', - }.each do |old_lib_dir, new_lib_dir| - lib_files = rb_files_in(new_lib_dir) + rubygems_dir = File.join lib_dir, 'rubygems' + lib_files = rb_files_in 'lib/rubygems' - old_lib_files = rb_files_in(old_lib_dir) + old_lib_files = rb_files_in rubygems_dir - to_remove = old_lib_files - lib_files + to_remove = old_lib_files - lib_files - to_remove.delete_if do |file| - file.start_with? 'defaults' - end + to_remove.delete_if do |file| + file.start_with? 'defaults' + end - Dir.chdir old_lib_dir do - to_remove.each do |file| - FileUtils.rm_f file + Dir.chdir rubygems_dir do + to_remove.each do |file| + FileUtils.rm_f file - warn "unable to remove old file #{file} please remove it by hand" if - File.exist? file - end + warn "unable to remove old file #{file} please remove it by hand" if + File.exist? file end end end @@ -511,3 +481,4 @@ abort "#{deprecation_message}" end end + |