method
windows_stub_script
v2_6_3 -
Show latest stable
- Class:
Gem::Installer
windows_stub_script(bindir, bin_file_name)public
return the stub script text used to launch the true Ruby script
# File lib/rubygems/installer.rb, line 790
def windows_stub_script(bindir, bin_file_name)
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']}"
ruby_exe = "ruby.exe" if ruby_exe.empty?
if File.exist?(File.join bindir, ruby_exe)
# stub & ruby.exe withing same folder. Portable
@ECHO OFF@"%~dp0ruby.exe" "%~dpn0" %*
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_topdir}/bin"
rel = to.relative_path_from from
@ECHO OFF@"%~dp0#{rel}/ruby.exe" "%~dpn0" %*
else
# outside ruby folder, maybe -user-install or bundler. Portable, but ruby
# is dependent on PATH
@ECHO [email protected] "%~dpn0" %*
end
end Related methods
- Instance methods
- app_script_text
- build_extensions
- check_executable_overwrite
- check_that_user_bin_dir_is_in_path
- default_spec_file
- dir
- ensure_dependencies_met
- ensure_dependency
- ensure_loadable_spec
- ensure_required_ruby_version_met
- ensure_required_rubygems_version_met
- extension_build_error
- extract_bin
- extract_files
- formatted_program_filename
- gem_dir
- generate_bin
- generate_bin_script
- generate_bin_symlink
- generate_windows_script
- install
- installation_satisfies_dependency?
- installed_specs
- pre_install_checks
- process_options
- run_post_build_hooks
- run_post_install_hooks
- run_pre_install_hooks
- shebang
- spec
- spec_file
- unpack
- verify_gem_home
- verify_spec
- windows_stub_script
- write_build_info_file
- write_cache_file
- write_default_spec
- write_spec
- Class methods
- at
- exec_format
- for_spec
- new