Permalink
Browse files

Add deprecated runtime flag

  • Loading branch information...
1 parent bfe14c2 commit 304a225058d64614de44c086ed424d4d772d9616 @josh josh committed May 20, 2012
Showing with 15 additions and 2 deletions.
  1. +1 −1 Rakefile
  2. +4 −0 lib/execjs/disabled_runtime.rb
  3. +5 −0 lib/execjs/external_runtime.rb
  4. +4 −0 lib/execjs/runtime.rb
  5. +1 −1 lib/execjs/runtimes.rb
View
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
View
4 lib/execjs/disabled_runtime.rb
@@ -18,6 +18,10 @@ def compile(source)
raise Error, "ExecJS disabled"
end
+ def deprecated?
+ true
+ end
+
def available?
true
end
View
5 lib/execjs/external_runtime.rb
@@ -95,6 +95,7 @@ def initialize(options)
@test_args = options[:test_args]
@test_match = options[:test_match]
@encoding = options[:encoding]
+ @deprecated = !!options[:deprecated]
@binary = nil
end
@@ -103,6 +104,10 @@ def available?
binary ? true : false
end
+ def deprecated?
+ @deprecated
+ end
+
private
def binary
@binary ||= locate_binary
View
4 lib/execjs/runtime.rb
@@ -44,6 +44,10 @@ def compile(source)
context_class.new(self, source)
end
+ def deprecated?
+ false
+ end
+
def available?
raise NotImplementedError
end
View
2 lib/execjs/runtimes.rb
@@ -52,7 +52,7 @@ def self.autodetect
end
def self.best_available
- runtimes.find(&:available?)
+ runtimes.reject(&:deprecated?).find(&:available?)
end
def self.from_environment

0 comments on commit 304a225

Please sign in to comment.