Prefer RbConfig.ruby over the 3.times fallback (#8691)
It seems saner to use RbConfig.ruby than using ruby in a random ancestor directory.
This commit is contained in:
parent
7a3a98e2be
commit
6c46ccf226
@ -15,23 +15,22 @@ end
|
|||||||
module EnvUtil
|
module EnvUtil
|
||||||
def rubybin
|
def rubybin
|
||||||
if ruby = ENV["RUBY"]
|
if ruby = ENV["RUBY"]
|
||||||
return ruby
|
ruby
|
||||||
end
|
elsif defined?(RbConfig.ruby)
|
||||||
ruby = "ruby"
|
|
||||||
exeext = RbConfig::CONFIG["EXEEXT"]
|
|
||||||
rubyexe = (ruby + exeext if exeext and !exeext.empty?)
|
|
||||||
3.times do
|
|
||||||
if File.exist? ruby and File.executable? ruby and !File.directory? ruby
|
|
||||||
return File.expand_path(ruby)
|
|
||||||
end
|
|
||||||
if rubyexe and File.exist? rubyexe and File.executable? rubyexe
|
|
||||||
return File.expand_path(rubyexe)
|
|
||||||
end
|
|
||||||
ruby = File.join("..", ruby)
|
|
||||||
end
|
|
||||||
if defined?(RbConfig.ruby)
|
|
||||||
RbConfig.ruby
|
RbConfig.ruby
|
||||||
else
|
else
|
||||||
|
ruby = "ruby"
|
||||||
|
exeext = RbConfig::CONFIG["EXEEXT"]
|
||||||
|
rubyexe = (ruby + exeext if exeext and !exeext.empty?)
|
||||||
|
3.times do
|
||||||
|
if File.exist? ruby and File.executable? ruby and !File.directory? ruby
|
||||||
|
return File.expand_path(ruby)
|
||||||
|
end
|
||||||
|
if rubyexe and File.exist? rubyexe and File.executable? rubyexe
|
||||||
|
return File.expand_path(rubyexe)
|
||||||
|
end
|
||||||
|
ruby = File.join("..", ruby)
|
||||||
|
end
|
||||||
"ruby"
|
"ruby"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user