2003-10-04 22:56:42 -04:00
|
|
|
module EnvUtil
|
|
|
|
def rubybin
|
2006-02-03 04:15:42 -05:00
|
|
|
unless ENV["RUBYOPT"]
|
|
|
|
|
|
|
|
end
|
2004-05-19 10:45:49 -04:00
|
|
|
if ruby = ENV["RUBY"]
|
|
|
|
return ruby
|
|
|
|
end
|
2005-12-29 03:05:26 -05:00
|
|
|
ruby = "ruby"
|
2006-02-03 04:15:42 -05:00
|
|
|
rubyexe = ruby+".exe"
|
2003-10-13 09:05:24 -04:00
|
|
|
3.times do
|
2006-02-03 04:15:42 -05:00
|
|
|
if File.exist? ruby and File.executable? ruby and !File.directory? ruby
|
|
|
|
return File.expand_path(ruby)
|
|
|
|
end
|
|
|
|
if File.exist? rubyexe and File.executable? rubyexe
|
2005-12-29 03:05:26 -05:00
|
|
|
return File.expand_path(ruby)
|
2003-10-13 09:05:24 -04:00
|
|
|
end
|
2005-12-29 03:05:26 -05:00
|
|
|
ruby = File.join("..", ruby)
|
2003-10-13 10:59:25 -04:00
|
|
|
end
|
|
|
|
begin
|
|
|
|
require "rbconfig"
|
|
|
|
File.join(
|
* mkconfig.rb: generate RbConfig instead of Config.
* instruby.rb, rubytest.rb, runruby.rb, bcc32/Makefile.sub,
ext/extmk.rb, ext/dl/extconf.rb, ext/iconv/charset_alias.rb,
lib/mkmf.rb, lib/rdoc/ri/ri_paths.rb,
lib/webrick/httpservlet/cgihandler.rb,
test/dbm/test_dbm.rb, test/gdbm/test_gdbm.rb,
test/ruby/envutil.rb, test/soap/calc/test_calc_cgi.rb,
test/soap/header/test_authheader_cgi.rb, test/soap/ssl/test_ssl.rb,
win32/mkexports.rb, win32/resource.rb: Use RbConfig instead of
Config.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-02-20 03:34:53 -05:00
|
|
|
RbConfig::CONFIG["bindir"],
|
|
|
|
RbConfig::CONFIG["ruby_install_name"] + RbConfig::CONFIG["EXEEXT"]
|
2003-10-13 10:59:25 -04:00
|
|
|
)
|
|
|
|
rescue LoadError
|
|
|
|
"ruby"
|
2003-10-04 22:56:42 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
module_function :rubybin
|
|
|
|
end
|