summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-09-04 00:12:49 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-09-04 00:12:49 +0000
commit6853c9e1690ee9e28a3dae538dd6f02b6f69c801 (patch)
treead6b5359a291c9a5819c126bc6f27873c6803cdd /lib
parentaa5d99280db64815565274141c330eae91e314a3 (diff)
RubyGems installer.rb - fix up my mistakes in r64582
From: MSP-Greg <greg.mpls@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64623 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/rubygems/installer.rb18
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb
index 657f21296f..8cb89e2e40 100644
--- a/lib/rubygems/installer.rb
+++ b/lib/rubygems/installer.rb
@@ -771,26 +771,30 @@ TEXT
# return the stub script text used to launch the true Ruby script
def windows_stub_script(bindir, bin_file_name)
- rb_bindir = RbConfig::CONFIG["bindir"]
- # All comparisons should be case insensitive
- if bindir.downcase == rb_bindir.downcase
+ rb_config = RbConfig::CONFIG
+ rb_topdir = RbConfig::TOPDIR || File.dirname(rb_config["bindir"])
+ # get ruby executable file name from RbConfig
+ ruby_exe = "#{rb_config['RUBY_INSTALL_NAME']}#{rb_config['EXEEXT']}"
+
+ if File.exist?(File.join bindir, ruby_exe)
# stub & ruby.exe withing same folder. Portable
<<-TEXT
@ECHO OFF
@"%~dp0ruby.exe" "%~dpn0" %*
TEXT
- elsif bindir.downcase.start_with? (RbConfig::TOPDIR || File.dirname(rb_bindir)).downcase
- # stub within ruby folder, but not standard bin. Not portable
+ elsif bindir.downcase.start_with? rb_topdir.downcase
+ # stub within ruby folder, but not standard bin. Portable
require 'pathname'
from = Pathname.new bindir
- to = Pathname.new rb_bindir
+ to = Pathname.new "#{rb_topdir}/bin"
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
+ # outside ruby folder, maybe -user-install or bundler. Portable, but ruby
+ # is dependent on PATH
<<-TEXT
@ECHO OFF
@ruby.exe "%~dpn0" %*