mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
d3ba99c15f
environment variable. [ruby-dev:23538] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6366 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
24 lines
523 B
Ruby
24 lines
523 B
Ruby
module EnvUtil
|
|
def rubybin
|
|
if ruby = ENV["RUBY"]
|
|
return ruby
|
|
end
|
|
miniruby = "miniruby"
|
|
3.times do
|
|
if File.exist? miniruby or File.exist? miniruby+".exe"
|
|
return File.expand_path(miniruby)
|
|
end
|
|
miniruby = File.join("..", miniruby)
|
|
end
|
|
begin
|
|
require "rbconfig"
|
|
File.join(
|
|
Config::CONFIG["bindir"],
|
|
Config::CONFIG["ruby_install_name"] + Config::CONFIG["EXEEXT"]
|
|
)
|
|
rescue LoadError
|
|
"ruby"
|
|
end
|
|
end
|
|
module_function :rubybin
|
|
end
|