From 3ba9e6b639afaf4c88145d56c9bd6746af16cfb7 Mon Sep 17 00:00:00 2001 From: hsbt Date: Thu, 9 Nov 2017 00:42:19 +0000 Subject: [PATCH] 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.rb | 2 +- lib/rubygems/commands/setup_command.rb | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/lib/rubygems.rb b/lib/rubygems.rb index c4c279e964..56290aa570 100644 --- a/lib/rubygems.rb +++ b/lib/rubygems.rb @@ -10,7 +10,7 @@ require 'rbconfig' require 'thread' module Gem - VERSION = "2.7.1" + VERSION = "2.7.2" end # Must be first since it unloads the prelude from 1.9.2 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