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:
parent
c5e22c4716
commit
5d0d51b6ba
2 changed files with 13 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue