Hello community, here is the log from the commit of package rubygem-execjs for openSUSE:Factory checked in at 2016-05-29 03:11:11 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-execjs (Old) and /work/SRC/openSUSE:Factory/.rubygem-execjs.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-execjs" Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-execjs/rubygem-execjs.changes 2015-08-27 08:56:11.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-execjs.new/rubygem-execjs.changes 2016-05-29 03:12:37.000000000 +0200 @@ -1,0 +2,6 @@ +Fri May 20 04:37:35 UTC 2016 - [email protected] + +- updated to version 2.7.0 + no changelog found + +------------------------------------------------------------------- Old: ---- execjs-2.6.0.gem New: ---- execjs-2.7.0.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-execjs.spec ++++++ --- /var/tmp/diff_new_pack.SKwCyw/_old 2016-05-29 03:12:38.000000000 +0200 +++ /var/tmp/diff_new_pack.SKwCyw/_new 2016-05-29 03:12:38.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package rubygem-execjs # -# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -24,7 +24,7 @@ # Name: rubygem-execjs -Version: 2.6.0 +Version: 2.7.0 Release: 0 %define mod_name execjs %define mod_full_name %{mod_name}-%{version} @@ -48,7 +48,7 @@ %install %gem_install \ - --doc-files="LICENSE README.md" \ + --doc-files="MIT-LICENSE README.md" \ -f %gem_packages ++++++ execjs-2.6.0.gem -> execjs-2.7.0.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/LICENSE new/LICENSE --- old/LICENSE 2015-08-14 19:58:59.000000000 +0200 +++ new/LICENSE 1970-01-01 01:00:00.000000000 +0100 @@ -1,21 +0,0 @@ -Copyright (c) 2015 Sam Stephenson -Copyright (c) 2015 Josh Peek - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/MIT-LICENSE new/MIT-LICENSE --- old/MIT-LICENSE 1970-01-01 01:00:00.000000000 +0100 +++ new/MIT-LICENSE 2016-05-20 05:58:24.000000000 +0200 @@ -0,0 +1,21 @@ +Copyright (c) 2015-2016 Sam Stephenson +Copyright (c) 2015-2016 Josh Peek + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.md new/README.md --- old/README.md 2015-08-14 19:58:59.000000000 +0200 +++ new/README.md 2016-05-20 05:58:24.000000000 +0200 @@ -15,6 +15,9 @@ * [Node.js](http://nodejs.org/) * Apple JavaScriptCore - Included with Mac OS X * [Microsoft Windows Script Host](http://msdn.microsoft.com/en-us/library/9bbdkx3k.aspx) (JScript) +* [Google V8](http://code.google.com/p/v8/) +* [mini_racer](https://github.com/discourse/mini_racer) - Google V8 + embedded within Ruby A short example: @@ -42,7 +45,6 @@ $ gem install execjs ``` - # FAQ **Why can't I use CommonJS `require()` inside ExecJS?** @@ -72,9 +74,12 @@ You shouldn't use `ExecJS.eval` on any inputs you wouldn't feel comfortable Ruby `eval()`ing. +## Contributing to ExecJS -# License +ExecJS is work of hundreds of contributors. You're encouraged to submit pull requests, propose +features and discuss issues. -Copyright (c) 2015 Sam Stephenson and Josh Peek. +See [CONTRIBUTING](CONTRIBUTING.md). -Released under the MIT license. See `LICENSE` for details. +## License +ExecJS is released under the [MIT License](MIT-LICENSE). Files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/execjs/disabled_runtime.rb new/lib/execjs/disabled_runtime.rb --- old/lib/execjs/disabled_runtime.rb 2015-08-14 19:58:59.000000000 +0200 +++ new/lib/execjs/disabled_runtime.rb 2016-05-20 05:58:24.000000000 +0200 @@ -6,15 +6,15 @@ "Disabled" end - def exec(source) + def exec(source, options = {}) raise Error, "ExecJS disabled" end - def eval(source) + def eval(source, options = {}) raise Error, "ExecJS disabled" end - def compile(source) + def compile(source, options = {}) raise Error, "ExecJS disabled" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/execjs/duktape_runtime.rb new/lib/execjs/duktape_runtime.rb --- old/lib/execjs/duktape_runtime.rb 2015-08-14 19:58:59.000000000 +0200 +++ new/lib/execjs/duktape_runtime.rb 2016-05-20 05:58:24.000000000 +0200 @@ -4,7 +4,7 @@ module ExecJS class DuktapeRuntime < Runtime class Context < Runtime::Context - def initialize(runtime, source = "") + def initialize(runtime, source = "", options = {}) @ctx = Duktape::Context.new(complex_object: nil) @ctx.exec_string(encode(source), '(execjs)') rescue Exception => e diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/execjs/external_runtime.rb new/lib/execjs/external_runtime.rb --- old/lib/execjs/external_runtime.rb 2015-08-14 19:58:59.000000000 +0200 +++ new/lib/execjs/external_runtime.rb 2016-05-20 05:58:24.000000000 +0200 @@ -4,7 +4,7 @@ module ExecJS class ExternalRuntime < Runtime class Context < Runtime::Context - def initialize(runtime, source = "") + def initialize(runtime, source = "", options = {}) source = encode(source) @runtime = runtime diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/execjs/mini_racer_runtime.rb new/lib/execjs/mini_racer_runtime.rb --- old/lib/execjs/mini_racer_runtime.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/execjs/mini_racer_runtime.rb 2016-05-20 05:58:24.000000000 +0200 @@ -0,0 +1,102 @@ +require "execjs/runtime" + +module ExecJS + class MiniRacerRuntime < Runtime + class Context < Runtime::Context + def initialize(runtime, source = "", options={}) + source = encode(source) + @context = ::MiniRacer::Context.new + translate do + @context.eval(source) + end + end + + def exec(source, options = {}) + source = encode(source) + + if /\S/ =~ source + eval "(function(){#{source}})()" + end + end + + def eval(source, options = {}) + source = encode(source) + + if /\S/ =~ source + translate do + @context.eval("(#{source})") + end + end + end + + def call(identifier, *args) + # TODO optimise generate + eval "#{identifier}.apply(this, #{::JSON.generate(args)})" + end + + private + + def strip_functions!(value) + if Array === value + value.map! do |v| + if MiniRacer::JavaScriptFunction === value + nil + else + strip_functions!(v) + end + end + elsif Hash === value + value.each do |k,v| + if MiniRacer::JavaScriptFunction === v + value.delete k + else + value[k] = strip_functions!(v) + end + end + value + elsif MiniRacer::JavaScriptFunction === value + nil + else + value + end + end + + def translate + begin + strip_functions! yield + rescue MiniRacer::RuntimeError => e + ex = ProgramError.new e.message + if backtrace = e.backtrace + backtrace = backtrace.map { |line| + if line =~ /JavaScript at/ + line.sub("JavaScript at ", "") + .sub("<anonymous>", "(execjs)") + .strip + else + line + end + } + ex.set_backtrace backtrace + end + raise ex + rescue MiniRacer::ParseError => e + ex = RuntimeError.new e.message + ex.set_backtrace(["(execjs):1"] + e.backtrace) + raise ex + end + end + + end + + def name + "mini_racer (V8)" + end + + def available? + require "mini_racer" + true + rescue LoadError + false + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/execjs/module.rb new/lib/execjs/module.rb --- old/lib/execjs/module.rb 2015-08-14 19:58:59.000000000 +0200 +++ new/lib/execjs/module.rb 2016-05-20 05:58:24.000000000 +0200 @@ -15,16 +15,16 @@ @runtime = runtime end - def exec(source) - runtime.exec(source) + def exec(source, options = {}) + runtime.exec(source, options) end - def eval(source) - runtime.eval(source) + def eval(source, options = {}) + runtime.eval(source, options) end - def compile(source) - runtime.compile(source) + def compile(source, options = {}) + runtime.compile(source, options) end def root diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/execjs/ruby_racer_runtime.rb new/lib/execjs/ruby_racer_runtime.rb --- old/lib/execjs/ruby_racer_runtime.rb 2015-08-14 19:58:59.000000000 +0200 +++ new/lib/execjs/ruby_racer_runtime.rb 2016-05-20 05:58:24.000000000 +0200 @@ -3,7 +3,7 @@ module ExecJS class RubyRacerRuntime < Runtime class Context < Runtime::Context - def initialize(runtime, source = "") + def initialize(runtime, source = "", options = {}) source = encode(source) lock do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/execjs/ruby_rhino_runtime.rb new/lib/execjs/ruby_rhino_runtime.rb --- old/lib/execjs/ruby_rhino_runtime.rb 2015-08-14 19:58:59.000000000 +0200 +++ new/lib/execjs/ruby_rhino_runtime.rb 2016-05-20 05:58:24.000000000 +0200 @@ -3,7 +3,7 @@ module ExecJS class RubyRhinoRuntime < Runtime class Context < Runtime::Context - def initialize(runtime, source = "") + def initialize(runtime, source = "", options = {}) source = encode(source) @rhino_context = ::Rhino::Context.new diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/execjs/runtime.rb new/lib/execjs/runtime.rb --- old/lib/execjs/runtime.rb 2015-08-14 19:58:59.000000000 +0200 +++ new/lib/execjs/runtime.rb 2016-05-20 05:58:24.000000000 +0200 @@ -6,7 +6,7 @@ class Context include Encoding - def initialize(runtime, source = "") + def initialize(runtime, source = "", options = {}) end def exec(source, options = {}) @@ -30,18 +30,32 @@ self.class::Context end - def exec(source) - context = context_class.new(self) - context.exec(source) + def exec(source, options = {}) + context = compile("", options) + + if context.method(:exec).arity == 1 + context.exec(source) + else + context.exec(source, options) + end end - def eval(source) - context = context_class.new(self) - context.eval(source) + def eval(source, options = {}) + context = compile("", options) + + if context.method(:eval).arity == 1 + context.eval(source) + else + context.eval(source, options) + end end - def compile(source) - context_class.new(self, source) + def compile(source, options = {}) + if context_class.instance_method(:initialize).arity == 2 + context_class.new(self, source) + else + context_class.new(self, source, options) + end end def deprecated? diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/execjs/runtimes.rb new/lib/execjs/runtimes.rb --- old/lib/execjs/runtimes.rb 2015-08-14 19:58:59.000000000 +0200 +++ new/lib/execjs/runtimes.rb 2016-05-20 05:58:24.000000000 +0200 @@ -4,6 +4,7 @@ require "execjs/external_runtime" require "execjs/ruby_racer_runtime" require "execjs/ruby_rhino_runtime" +require "execjs/mini_racer_runtime" module ExecJS module Runtimes @@ -15,6 +16,8 @@ RubyRhino = RubyRhinoRuntime.new + MiniRacer = MiniRacerRuntime.new + Node = ExternalRuntime.new( name: "Node.js (V8)", command: ["nodejs", "node"], @@ -42,6 +45,13 @@ encoding: 'UTF-16LE' # CScript with //U returns UTF-16LE ) + V8 = ExternalRuntime.new( + name: "V8", + command: "d8", + runner_path: ExecJS.root + "/support/v8_runner.js", + encoding: 'UTF-8' + ) + def self.autodetect from_environment || best_available || @@ -72,10 +82,12 @@ RubyRacer, RubyRhino, Duktape, + MiniRacer, Node, JavaScriptCore, SpiderMonkey, - JScript + JScript, + V8 ] end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/execjs/support/v8_runner.js new/lib/execjs/support/v8_runner.js --- old/lib/execjs/support/v8_runner.js 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/execjs/support/v8_runner.js 2016-05-20 05:58:24.000000000 +0200 @@ -0,0 +1,18 @@ +(function(program, execJS) { execJS(program) })(function() { #{source} +}, function(program) { + var output; + try { + result = program(); + if (typeof result == 'undefined' && result !== null) { + print('["ok"]'); + } else { + try { + print(JSON.stringify(['ok', result])); + } catch (err) { + print(JSON.stringify(['err', '' + err, err.stack])); + } + } + } catch (err) { + print(JSON.stringify(['err', '' + err, err.stack])); + } +}); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/execjs/version.rb new/lib/execjs/version.rb --- old/lib/execjs/version.rb 2015-08-14 19:58:59.000000000 +0200 +++ new/lib/execjs/version.rb 2016-05-20 05:58:24.000000000 +0200 @@ -1,3 +1,3 @@ module ExecJS - VERSION = "2.6.0" + VERSION = "2.7.0" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2015-08-14 19:58:59.000000000 +0200 +++ new/metadata 2016-05-20 05:58:24.000000000 +0200 @@ -1,7 +1,7 @@ --- !ruby/object:Gem::Specification name: execjs version: !ruby/object:Gem::Version - version: 2.6.0 + version: 2.7.0 platform: ruby authors: - Sam Stephenson @@ -9,7 +9,7 @@ autorequire: bindir: bin cert_chain: [] -date: 2015-08-14 00:00:00.000000000 Z +date: 2016-05-20 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: rake @@ -33,13 +33,14 @@ extensions: [] extra_rdoc_files: [] files: -- LICENSE +- MIT-LICENSE - README.md - lib/execjs.rb - lib/execjs/disabled_runtime.rb - lib/execjs/duktape_runtime.rb - lib/execjs/encoding.rb - lib/execjs/external_runtime.rb +- lib/execjs/mini_racer_runtime.rb - lib/execjs/module.rb - lib/execjs/ruby_racer_runtime.rb - lib/execjs/ruby_rhino_runtime.rb @@ -50,6 +51,7 @@ - lib/execjs/support/json2.js - lib/execjs/support/node_runner.js - lib/execjs/support/spidermonkey_runner.js +- lib/execjs/support/v8_runner.js - lib/execjs/version.rb homepage: https://github.com/rails/execjs licenses: @@ -71,9 +73,8 @@ version: '0' requirements: [] rubyforge_project: -rubygems_version: 2.4.7 +rubygems_version: 2.5.1 signing_key: specification_version: 4 summary: Run JavaScript code from Ruby test_files: [] -has_rdoc:
