mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
aa5d99280d
commit
6853c9e169
1 changed files with 11 additions and 7 deletions
|
@ -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" %*
|
||||
|
|
Loading…
Add table
Reference in a new issue