From 3ba9e6b639afaf4c88145d56c9bd6746af16cfb7 Mon Sep 17 00:00:00 2001 From: hsbt Date: Thu, 9 Nov 2017 00:42:19 +0000 Subject: Merge rubygems-2.7.2. This version fixes some setup commands. https://github.com/rubygems/rubygems/blob/01e797f6aa045fd09df7813d0b5448e3667172a9/History.txt#L3 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60721 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rubygems/commands/setup_command.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'lib/rubygems') diff --git a/lib/rubygems/commands/setup_command.rb b/lib/rubygems/commands/setup_command.rb index 5f39b4c93c..93a46d4350 100644 --- a/lib/rubygems/commands/setup_command.rb +++ b/lib/rubygems/commands/setup_command.rb @@ -294,6 +294,8 @@ By default, this RubyGems will install gem as: say "Installing #{tool}" if @verbose lib_files = rb_files_in path + lib_files.concat(template_files) if tool == 'Bundler' + pem_files = pem_files_in path Dir.chdir path do @@ -354,6 +356,10 @@ By default, this RubyGems will install gem as: mkdir_p Gem::Specification.default_specifications_dir + # Workaround for non-git environment. + gemspec = File.read('bundler/bundler.gemspec').gsub(/`git ls-files -z`/, "''") + File.open('bundler/bundler.gemspec', 'w'){|f| f.write gemspec } + bundler_spec = Gem::Specification.load("bundler/bundler.gemspec") bundler_spec.files = Dir.chdir("bundler") { Dir["{*.md,{lib,exe,man}/**/*}"] } bundler_spec.executables -= %w[bundler bundle_ruby] @@ -433,6 +439,22 @@ By default, this RubyGems will install gem as: end end + # for installation of bundler as default gems + def template_files + Dir.chdir "bundler/lib" do + (Dir[File.join('bundler', 'templates', '**', '*')] + Dir[File.join('bundler', 'templates', '**', '.*')]). + select{|f| !File.directory?(f)} + end + end + + # for cleanup old bundler files + def template_files_in dir + Dir.chdir dir do + (Dir[File.join('templates', '**', '*')] + Dir[File.join('templates', '**', '.*')]). + select{|f| !File.directory?(f)} + end + end + def remove_old_bin_files(bin_dir) old_bin_files = { 'gem_mirror' => 'gem mirror', @@ -470,8 +492,10 @@ abort "#{deprecation_message}" lib_dirs[File.join(lib_dir, 'bundler')] = 'bundler/lib/bundler' if Gem::USE_BUNDLER_FOR_GEMDEPS lib_dirs.each do |old_lib_dir, new_lib_dir| lib_files = rb_files_in(new_lib_dir) + lib_files.concat(template_files_in(new_lib_dir)) if new_lib_dir =~ /bundler/ old_lib_files = rb_files_in(old_lib_dir) + old_lib_files.concat(template_files_in(old_lib_dir)) if old_lib_dir =~ /bundler/ to_remove = old_lib_files - lib_files -- cgit v1.2.3