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:
parent
bfe14c23b7
commit
304a225058
5 changed files with 15 additions and 2 deletions
2
Rakefile
2
Rakefile
|
@ -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
|
||||
|
|
|
@ -18,6 +18,10 @@ module ExecJS
|
|||
raise Error, "ExecJS disabled"
|
||||
end
|
||||
|
||||
def deprecated?
|
||||
true
|
||||
end
|
||||
|
||||
def available?
|
||||
true
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -44,6 +44,10 @@ module ExecJS
|
|||
context_class.new(self, source)
|
||||
end
|
||||
|
||||
def deprecated?
|
||||
false
|
||||
end
|
||||
|
||||
def available?
|
||||
raise NotImplementedError
|
||||
end
|
||||
|
|
|
@ -52,7 +52,7 @@ module ExecJS
|
|||
end
|
||||
|
||||
def self.best_available
|
||||
runtimes.find(&:available?)
|
||||
runtimes.reject(&:deprecated?).find(&:available?)
|
||||
end
|
||||
|
||||
def self.from_environment
|
||||
|
|
Loading…
Reference in a new issue