diff --git a/.travis.yml b/.travis.yml index 714f712..3151394 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,8 +16,6 @@ matrix: env: EXECJS_RUNTIME=Node - rvm: 2.0.0 env: EXECJS_RUNTIME=Duktape - - rvm: 2.0.0 - env: EXECJS_RUNTIME=RubyRacer - rvm: 2.0.0 env: EXECJS_RUNTIME=MiniRacer dist: trusty @@ -27,8 +25,6 @@ matrix: env: EXECJS_RUNTIME=Node - rvm: 2.1.10 env: EXECJS_RUNTIME=Duktape - - rvm: 2.1.10 - env: EXECJS_RUNTIME=RubyRacer - rvm: 2.1.10 env: EXECJS_RUNTIME=MiniRacer dist: trusty @@ -38,8 +34,6 @@ matrix: env: EXECJS_RUNTIME=Node - rvm: 2.2.7 env: EXECJS_RUNTIME=Duktape - - rvm: 2.2.7 - env: EXECJS_RUNTIME=RubyRacer - rvm: 2.2.7 env: EXECJS_RUNTIME=MiniRacer dist: trusty @@ -49,8 +43,6 @@ matrix: env: EXECJS_RUNTIME=Node - rvm: 2.3.4 env: EXECJS_RUNTIME=Duktape - - rvm: 2.3.4 - env: EXECJS_RUNTIME=RubyRacer - rvm: 2.3.4 env: EXECJS_RUNTIME=MiniRacer dist: trusty @@ -60,8 +52,6 @@ matrix: env: EXECJS_RUNTIME=Node - rvm: 2.4.1 env: EXECJS_RUNTIME=Duktape - - rvm: 2.4.1 - env: EXECJS_RUNTIME=RubyRacer - rvm: 2.4.1 env: EXECJS_RUNTIME=MiniRacer dist: trusty @@ -71,8 +61,6 @@ matrix: env: EXECJS_RUNTIME=Node - rvm: ruby-head env: EXECJS_RUNTIME=Duktape - - rvm: ruby-head - env: EXECJS_RUNTIME=RubyRacer - rvm: ruby-head env: EXECJS_RUNTIME=MiniRacer dist: trusty @@ -89,8 +77,6 @@ matrix: env: EXECJS_RUNTIME=Node - os: osx env: EXECJS_RUNTIME=Duktape - - os: osx - env: EXECJS_RUNTIME=RubyRacer - os: osx env: EXECJS_RUNTIME=V8 - os: osx diff --git a/Gemfile b/Gemfile index 7aabdc2..048142c 100644 --- a/Gemfile +++ b/Gemfile @@ -4,11 +4,7 @@ gemspec group :test do gem 'duktape', platform: :mri - if ENV['EXECJS_RUNTIME'] == 'MiniRacer' - gem 'mini_racer', '0.1.0.beta.3', platform: :mri - else - gem 'therubyracer', platform: :mri - end + gem 'mini_racer', platform: :mri gem 'therubyrhino', '>=1.73.3', platform: :jruby gem 'minitest', require: false end diff --git a/README.md b/README.md index 22f014d..cf22749 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,6 @@ returns the result to you as a Ruby object. ExecJS supports these runtimes: -* [therubyracer](https://github.com/cowboyd/therubyracer) - Google V8 - embedded within Ruby * [therubyrhino](https://github.com/cowboyd/therubyrhino) - Mozilla Rhino embedded within JRuby * [Duktape.rb](https://github.com/judofyr/duktape.rb) - Duktape JavaScript interpreter diff --git a/lib/execjs/ruby_racer_runtime.rb b/lib/execjs/ruby_racer_runtime.rb deleted file mode 100644 index 682efd5..0000000 --- a/lib/execjs/ruby_racer_runtime.rb +++ /dev/null @@ -1,114 +0,0 @@ -require "execjs/runtime" - -module ExecJS - class RubyRacerRuntime < Runtime - class Context < Runtime::Context - def initialize(runtime, source = "", options = {}) - source = encode(source) - - lock do - @v8_context = ::V8::Context.new - - begin - @v8_context.eval(source) - rescue ::V8::JSError => e - raise wrap_error(e) - end - end - end - - def exec(source, options = {}) - source = encode(source) - - if /\S/ =~ source - eval "(function(){#{source}})()", options - end - end - - def eval(source, options = {}) - source = encode(source) - - if /\S/ =~ source - lock do - begin - unbox @v8_context.eval("(#{source})") - rescue ::V8::JSError => e - raise wrap_error(e) - end - end - end - end - - def call(properties, *args) - lock do - begin - unbox @v8_context.eval("(#{properties})").call(*args) - rescue ::V8::JSError => e - raise wrap_error(e) - end - end - end - - def unbox(value) - case value - when ::V8::Function - nil - when ::V8::Array - value.map { |v| unbox(v) } - when ::V8::Object - value.inject({}) do |vs, (k, v)| - vs[k] = unbox(v) unless v.is_a?(::V8::Function) - vs - end - when String - value.force_encoding('UTF-8') - else - value - end - end - - private - def lock - result, exception = nil, nil - V8::C::Locker() do - begin - result = yield - rescue Exception => e - exception = e - end - end - - if exception - raise exception - else - result - end - end - - def wrap_error(e) - error_class = e.value["name"] == "SyntaxError" ? RuntimeError : ProgramError - - stack = e.value["stack"] || "" - stack = stack.split("\n") - stack.shift - stack = [e.message[/:\d+:\d+/, 0]].compact if stack.empty? - stack = stack.map { |line| line.sub(" at ", "").sub("", "(execjs)").strip } - - error = error_class.new(e.value.to_s) - error.set_backtrace(stack + caller) - error - end - end - - def name - "therubyracer (V8)" - end - - def available? - require "v8" - true - rescue LoadError - false - end - end -end diff --git a/lib/execjs/runtimes.rb b/lib/execjs/runtimes.rb index 4ca5e1a..9804257 100644 --- a/lib/execjs/runtimes.rb +++ b/lib/execjs/runtimes.rb @@ -2,7 +2,6 @@ require "execjs/module" require "execjs/disabled_runtime" require "execjs/duktape_runtime" require "execjs/external_runtime" -require "execjs/ruby_racer_runtime" require "execjs/ruby_rhino_runtime" require "execjs/mini_racer_runtime" @@ -12,8 +11,6 @@ module ExecJS Duktape = DuktapeRuntime.new - RubyRacer = RubyRacerRuntime.new - RubyRhino = RubyRhinoRuntime.new MiniRacer = MiniRacerRuntime.new @@ -81,7 +78,6 @@ module ExecJS def self.runtimes @runtimes ||= [ - RubyRacer, RubyRhino, Duktape, MiniRacer,