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|
|
tests = namespace :test do |tests|
|
||||||
ExecJS::Runtimes.names.each do |name|
|
ExecJS::Runtimes.names.each do |name|
|
||||||
next if name.to_s == "Disabled"
|
next if ExecJS::Runtimes.const_get(name).deprecated?
|
||||||
|
|
||||||
task(name.downcase) do
|
task(name.downcase) do
|
||||||
ENV["EXECJS_RUNTIME"] = name.to_s
|
ENV["EXECJS_RUNTIME"] = name.to_s
|
||||||
|
|
|
@ -18,6 +18,10 @@ module ExecJS
|
||||||
raise Error, "ExecJS disabled"
|
raise Error, "ExecJS disabled"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def deprecated?
|
||||||
|
true
|
||||||
|
end
|
||||||
|
|
||||||
def available?
|
def available?
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
|
@ -95,6 +95,7 @@ module ExecJS
|
||||||
@test_args = options[:test_args]
|
@test_args = options[:test_args]
|
||||||
@test_match = options[:test_match]
|
@test_match = options[:test_match]
|
||||||
@encoding = options[:encoding]
|
@encoding = options[:encoding]
|
||||||
|
@deprecated = !!options[:deprecated]
|
||||||
@binary = nil
|
@binary = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -103,6 +104,10 @@ module ExecJS
|
||||||
binary ? true : false
|
binary ? true : false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def deprecated?
|
||||||
|
@deprecated
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def binary
|
def binary
|
||||||
@binary ||= locate_binary
|
@binary ||= locate_binary
|
||||||
|
|
|
@ -44,6 +44,10 @@ module ExecJS
|
||||||
context_class.new(self, source)
|
context_class.new(self, source)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def deprecated?
|
||||||
|
false
|
||||||
|
end
|
||||||
|
|
||||||
def available?
|
def available?
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
end
|
end
|
||||||
|
|
|
@ -52,7 +52,7 @@ module ExecJS
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.best_available
|
def self.best_available
|
||||||
runtimes.find(&:available?)
|
runtimes.reject(&:deprecated?).find(&:available?)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.from_environment
|
def self.from_environment
|
||||||
|
|
Loading…
Reference in a new issue