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
|
# return the stub script text used to launch the true Ruby script
|
||||||
|
|
||||||
def windows_stub_script(bindir, bin_file_name)
|
def windows_stub_script(bindir, bin_file_name)
|
||||||
rb_bindir = RbConfig::CONFIG["bindir"]
|
rb_config = RbConfig::CONFIG
|
||||||
# All comparisons should be case insensitive
|
rb_topdir = RbConfig::TOPDIR || File.dirname(rb_config["bindir"])
|
||||||
if bindir.downcase == rb_bindir.downcase
|
# 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
|
# stub & ruby.exe withing same folder. Portable
|
||||||
<<-TEXT
|
<<-TEXT
|
||||||
@ECHO OFF
|
@ECHO OFF
|
||||||
@"%~dp0ruby.exe" "%~dpn0" %*
|
@"%~dp0ruby.exe" "%~dpn0" %*
|
||||||
TEXT
|
TEXT
|
||||||
elsif bindir.downcase.start_with? (RbConfig::TOPDIR || File.dirname(rb_bindir)).downcase
|
elsif bindir.downcase.start_with? rb_topdir.downcase
|
||||||
# stub within ruby folder, but not standard bin. Not portable
|
# stub within ruby folder, but not standard bin. Portable
|
||||||
require 'pathname'
|
require 'pathname'
|
||||||
from = Pathname.new bindir
|
from = Pathname.new bindir
|
||||||
to = Pathname.new rb_bindir
|
to = Pathname.new "#{rb_topdir}/bin"
|
||||||
rel = to.relative_path_from from
|
rel = to.relative_path_from from
|
||||||
<<-TEXT
|
<<-TEXT
|
||||||
@ECHO OFF
|
@ECHO OFF
|
||||||
@"%~dp0#{rel}/ruby.exe" "%~dpn0" %*
|
@"%~dp0#{rel}/ruby.exe" "%~dpn0" %*
|
||||||
TEXT
|
TEXT
|
||||||
else
|
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
|
<<-TEXT
|
||||||
@ECHO OFF
|
@ECHO OFF
|
||||||
@ruby.exe "%~dpn0" %*
|
@ruby.exe "%~dpn0" %*
|
||||||
|
|
Loading…
Add table
Reference in a new issue