ruby-changes:51061
From: nobu <ko1@a...>
Date: Fri, 27 Apr 2018 10:58:33 +0900 (JST)
Subject: [ruby-changes:51061] nobu:r63268 (trunk): rbinstall.rb: fix timing to read stub
nobu 2018-04-27 10:58:29 +0900 (Fri, 27 Apr 2018) New Revision: 63268 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63268 Log: rbinstall.rb: fix timing to read stub * tool/rbinstall.rb ($script_installer.stub): read stub file on demand. as `$cmdtype` is set to "exe" in parse_args, it is not set yet when `$script_installer` is defined. Modified files: trunk/tool/rbinstall.rb Index: tool/rbinstall.rb =================================================================== --- tool/rbinstall.rb (revision 63267) +++ tool/rbinstall.rb (revision 63268) @@ -455,14 +455,11 @@ _=_\\ https://github.com/ruby/ruby/blob/trunk/tool/rbinstall.rb#L455 #{prolog_script}=end EOS -$script_installer = Struct.new(:ruby_shebang, :ruby_bin, :ruby_install_name, - :stub, :trans) do +installer = Struct.new(:ruby_shebang, :ruby_bin, :ruby_install_name, :stub, :trans) +$script_installer = Class.new(installer) do ruby_shebang = File.join(bindir, ruby_install_name) if File::ALT_SEPARATOR ruby_bin = ruby_shebang.tr(File::SEPARATOR, File::ALT_SEPARATOR) - if $cmdtype == 'exe' - stub = File.open("rubystub.exe", "rb") {|f| f.read} << "\n" rescue nil - end end if trans = CONFIG["program_transform_name"] exp = [] @@ -523,7 +520,20 @@ $script_installer = Struct.new(:ruby_she https://github.com/ruby/ruby/blob/trunk/tool/rbinstall.rb#L520 end end - break new(ruby_shebang, ruby_bin, ruby_install_name, stub, trans) + def self.get_rubystub + stubfile = "rubystub.exe" + stub = File.open(stubfile, "rb") {|f| f.read} << "\n" + rescue => e + abort "No #{stubfile}: #{e}" + else + stub + end + + def stub + super or self.stub = self.class.get_rubystub + end + + break new(ruby_shebang, ruby_bin, ruby_install_name, nil, trans) end install?(:local, :comm, :bin, :'bin-comm') do -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/