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

Add deprecated runtime flag

This commit is contained in:
Joshua Peek 2012-05-20 14:25:13 -05:00
parent bfe14c23b7
commit 304a225058
5 changed files with 15 additions and 2 deletions

View file

@ -7,7 +7,7 @@ require "execjs/runtimes"
tests = namespace :test do |tests|
ExecJS::Runtimes.names.each do |name|
next if name.to_s == "Disabled"
next if ExecJS::Runtimes.const_get(name).deprecated?
task(name.downcase) do
ENV["EXECJS_RUNTIME"] = name.to_s

View file

@ -18,6 +18,10 @@ module ExecJS
raise Error, "ExecJS disabled"
end
def deprecated?
true
end
def available?
true
end

View file

@ -95,6 +95,7 @@ module ExecJS
@test_args = options[:test_args]
@test_match = options[:test_match]
@encoding = options[:encoding]
@deprecated = !!options[:deprecated]
@binary = nil
end
@ -103,6 +104,10 @@ module ExecJS
binary ? true : false
end
def deprecated?
@deprecated
end
private
def binary
@binary ||= locate_binary

View file

@ -44,6 +44,10 @@ module ExecJS
context_class.new(self, source)
end
def deprecated?
false
end
def available?
raise NotImplementedError
end

View file

@ -52,7 +52,7 @@ module ExecJS
end
def self.best_available
runtimes.find(&:available?)
runtimes.reject(&:deprecated?).find(&:available?)
end
def self.from_environment