aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rubygems/installer.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems/installer.rb')
-rw-r--r--lib/rubygems/installer.rb18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb
index 7b4979d7ca..85358e0d1a 100644
--- a/lib/rubygems/installer.rb
+++ b/lib/rubygems/installer.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
@@ -213,7 +213,13 @@ class Gem::Installer
next unless io.gets =~ /This file was generated by RubyGems/
ruby_executable = true
- existing = io.read.slice(/^gem (['"])(.*?)(\1),/, 2)
+ existing = io.read.slice(%r{
+ ^(
+ gem \s |
+ load \s Gem\.bin_path\(
+ )
+ (['"])(.*?)(\2),
+ }x, 3)
end
return if spec.name == existing
@@ -221,7 +227,7 @@ class Gem::Installer
# somebody has written to RubyGems' directory, overwrite, too bad
return if Gem.default_bindir != @bin_dir and not ruby_executable
- question = "#{spec.name}'s executable \"#{filename}\" conflicts with "
+ question = "#{spec.name}'s executable \"#{filename}\" conflicts with ".dup
if ruby_executable then
question << existing
@@ -297,7 +303,7 @@ class Gem::Installer
write_cache_file
end
- say spec.post_install_message unless spec.post_install_message.nil?
+ say spec.post_install_message if options[:post_install_message] && !spec.post_install_message.nil?
Gem::Installer.install_lock.synchronize { Gem::Specification.reset }
@@ -627,7 +633,8 @@ class Gem::Installer
:bin_dir => nil,
:env_shebang => false,
:force => false,
- :only_install_dir => false
+ :only_install_dir => false,
+ :post_install_message => true
}.merge options
@env_shebang = options[:env_shebang]
@@ -712,7 +719,6 @@ if ARGV.first
end
end
-gem '#{spec.name}', version
load Gem.bin_path('#{spec.name}', '#{bin_file_name}', version)
TEXT
end