diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-08-27 10:05:04 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-08-27 10:05:04 +0000 |
commit | 85d461456c154d7b4a72b20369e0d65d7880ce02 (patch) | |
tree | 21e1be2c786c8040a426841768e046fb4dc365b1 /lib/rubygems/installer.rb | |
parent | 3a83ba90c35833bab757998def36cfe872dec461 (diff) | |
download | ruby-85d461456c154d7b4a72b20369e0d65d7880ce02.tar.gz |
Merge master branch from rubygems upstream.
* It's preparation to release RubyGems 3.0.0.beta2 and Ruby 2.6.0
preview 3.
* https://github.com/rubygems/rubygems/compare/v3.0.0.beta1...fad2eb15a282b19dfcb4b48bc95b8b39ebb4511f
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64555 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/installer.rb')
-rw-r--r-- | lib/rubygems/installer.rb | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb index b142454c09..e9ad4d03d4 100644 --- a/lib/rubygems/installer.rb +++ b/lib/rubygems/installer.rb @@ -187,6 +187,8 @@ class Gem::Installer @package.prog_mode = options[:prog_mode] @package.data_mode = options[:data_mode] + @bin_dir = options[:bin_dir] if options[:bin_dir] + if options[:user_install] and not options[:unpack] then @gem_home = Gem.user_dir @bin_dir = Gem.bindir gem_home unless options[:bin_dir] @@ -379,7 +381,7 @@ class Gem::Installer @specs ||= begin specs = [] - Dir[File.join(gem_home, "specifications", "*.gemspec")].each do |path| + Gem::Util.glob_files_in_dir("*.gemspec", File.join(gem_home, "specifications")).each do |path| spec = Gem::Specification.load path.untaint specs << spec if spec end @@ -769,15 +771,30 @@ TEXT # return the stub script text used to launch the true Ruby script def windows_stub_script(bindir, bin_file_name) - ruby = Gem.ruby.gsub(/^\"|\"$/, "").tr(File::SEPARATOR, "\\") - return <<-TEXT + # All comparisons should be case insensitive + if bindir.downcase == RbConfig::CONFIG["bindir"].downcase + # stub & ruby.exe withing same folder. Portable + <<-TEXT @ECHO OFF -IF NOT "%~f0" == "~f0" GOTO :WinNT -@"#{ruby}" "#{File.join(bindir, bin_file_name)}" %1 %2 %3 %4 %5 %6 %7 %8 %9 -GOTO :EOF -:WinNT -@"#{ruby}" "%~dpn0" %* -TEXT +@"%~dp0ruby.exe" "%~dpn0" %* + TEXT + elsif bindir.downcase.start_with? RbConfig::TOPDIR.downcase + # stub within ruby folder, but not standard bin. Not portable + require 'pathname' + from = Pathname.new bindir + to = Pathname.new RbConfig::CONFIG["bindir"] + rel = to.relative_path_from from + <<-TEXT +@ECHO OFF +@"%~dp0#{rel}/ruby.exe" "%~dpn0" %* + TEXT + else + # outside ruby folder, maybe -user-install or bundler. Portable + <<-TEXT +@ECHO OFF +@ruby.exe "%~dpn0" %* + TEXT + end end ## |