diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-09-04 00:12:49 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-09-04 00:12:49 +0000 |
commit | d0f044d0a4a695870ac0323c15efa3eeade13e83 (patch) | |
tree | ad6b5359a291c9a5819c126bc6f27873c6803cdd /lib | |
parent | c11a4d73c058921a41c25288079291ed256e7ba0 (diff) | |
download | ruby-d0f044d0a4a695870ac0323c15efa3eeade13e83.tar.gz |
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.rb | 18 |
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" %* |