1
0
Fork 0
mirror of https://github.com/rails/execjs synced 2023-03-27 23:21:20 -04:00

therubyracer gem installs an incompatible v8 binary - make sure we don't use it

This commit is contained in:
Sam Stephenson 2011-02-06 21:50:03 -06:00
parent c5e22c4716
commit 5d0d51b6ba
2 changed files with 13 additions and 2 deletions

View file

@ -6,6 +6,8 @@ module ExecJS
def initialize(options)
@command = options[:command]
@runner_path = options[:runner_path]
@test_args = options[:test_args]
@test_match = options[:test_match]
end
def eval(source)
@ -22,8 +24,15 @@ module ExecJS
def available?
command = @command.split(/\s+/).first
`which #{command}`
$? == 0
binary = `which #{command}`
if $? == 0
if @test_args
output = "#{binary} #{@test_args} 2>&1"
output.match(@test_match)
else
true
end
end
end
protected

View file

@ -20,6 +20,8 @@ module ExecJS
define_runtime :V8,
:command => "v8",
:test_args => "--help",
:test_match => /--crankshaft/,
:runner_path => runner_path("basic.js")
define_runtime :Node,