debian/0000755000000000000000000000000012000004210007141 5ustar debian/ruby-execjs.docs0000644000000000000000000000001211773040451012273 0ustar README.md debian/compat0000644000000000000000000000000211772460315010372 0ustar 7 debian/changelog0000644000000000000000000000052112000004210011011 0ustar ruby-execjs (1.4.0-2) unstable; urgency=low * Add missing build dependency on ruby-multi-json (Closes: #680836). -- Antonio Terceiro Fri, 13 Jul 2012 08:37:19 -0300 ruby-execjs (1.4.0-1) unstable; urgency=low * Initial release. -- Antonio Terceiro Tue, 26 Jun 2012 22:22:37 -0300 debian/copyright0000644000000000000000000000312011773040443011120 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: execjs Source: https://github.com/sstephenson/execjs Files: * Copyright: 2011 Sam Stephenson 2011 Josh Peek. License: MIT 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. Files: * Copyright: 2011 Sam Stephenson 2011 Josh Peek. License: MIT Files: debian/* Copyright: 2012 Antonio Terceiro License: MIT Files: debian/ruby-tests.rb Copyright: 2011 Sam Stephenson 2011 Josh Peek. License: MIT Comment: This file is a slightly modified version of test/test_execjs.rb present in the upstream Git repository. debian/control0000644000000000000000000000207712000004151010556 0ustar Source: ruby-execjs Section: ruby Priority: optional Maintainer: Debian Ruby Extras Maintainers Uploaders: Antonio Terceiro DM-Upload-Allowed: yes # FIXME remove nodejs and depend on ruby-therubyracer (?) Build-Depends: debhelper (>= 7.0.50~), gem2deb (>= 0.3.0~), ruby-multi-json, nodejs Standards-Version: 3.9.3 Vcs-Git: git://git.debian.org/pkg-ruby-extras/ruby-execjs.git Vcs-Browser: http://git.debian.org/?p=pkg-ruby-extras/ruby-execjs.git;a=summary Homepage: https://github.com/sstephenson/execjs XS-Ruby-Versions: all Package: ruby-execjs Architecture: all XB-Ruby-Versions: ${ruby:Versions} # FIXME remove nodejs and depend on ruby-therubyracer (?) Depends: ${shlibs:Depends}, ${misc:Depends}, ruby | ruby-interpreter, ruby-multi-json, nodejs Description: Run JavaScript code from Ruby ExecJS lets you run JavaScript code from Ruby. It can use several different JavaScript runtimes.. . This package is used by others (e.g. ruby-uglifier and ruby-coffee-script) to run code written in JavaScript. debian/rules0000755000000000000000000000007511773040462010254 0ustar #!/usr/bin/make -f %: dh $@ --buildsystem=ruby --with ruby debian/ruby-tests.rb0000644000000000000000000001175411772462232011652 0ustar # encoding: UTF-8 require "test/unit" require "execjs/module" begin require "execjs" rescue ExecJS::RuntimeUnavailable => e warn e exit 2 end class TestExecJS < Test::Unit::TestCase def test_runtime_available runtime = ExecJS::ExternalRuntime.new(:command => "nonexistent") assert !runtime.available? runtime = ExecJS::ExternalRuntime.new(:command => "ruby") assert runtime.available? end def test_runtime_assignment original_runtime = ExecJS.runtime runtime = ExecJS::ExternalRuntime.new(:command => "nonexistent") assert_raises(ExecJS::RuntimeUnavailable) { ExecJS.runtime = runtime } assert_equal original_runtime, ExecJS.runtime runtime = ExecJS::ExternalRuntime.new(:command => "ruby") ExecJS.runtime = runtime assert_equal runtime, ExecJS.runtime ensure ExecJS.runtime = original_runtime end def test_context_call context = ExecJS.compile("id = function(v) { return v; }") assert_equal "bar", context.call("id", "bar") end def test_nested_context_call context = ExecJS.compile("a = {}; a.b = {}; a.b.id = function(v) { return v; }") assert_equal "bar", context.call("a.b.id", "bar") end def test_context_call_missing_function context = ExecJS.compile("") assert_raises ExecJS::ProgramError do context.call("missing") end end def test_exec assert_nil ExecJS.exec("1") assert_nil ExecJS.exec("return") assert_nil ExecJS.exec("return null") assert_nil ExecJS.exec("return function() {}") assert_equal 0, ExecJS.exec("return 0") assert_equal true, ExecJS.exec("return true") assert_equal [1, 2], ExecJS.exec("return [1, 2]") assert_equal "hello", ExecJS.exec("return 'hello'") assert_equal({"a"=>1,"b"=>2}, ExecJS.exec("return {a:1,b:2}")) assert_equal "café", ExecJS.exec("return 'café'") assert_equal "☃", ExecJS.exec('return "☃"') assert_equal "☃", ExecJS.exec('return "\u2603"') assert_equal "\\", ExecJS.exec('return "\\\\"') end def test_eval assert_nil ExecJS.eval("") assert_nil ExecJS.eval(" ") assert_nil ExecJS.eval("null") assert_nil ExecJS.eval("function() {}") assert_equal 0, ExecJS.eval("0") assert_equal true, ExecJS.eval("true") assert_equal [1, 2], ExecJS.eval("[1, 2]") assert_equal [1, nil], ExecJS.eval("[1, function() {}]") assert_equal "hello", ExecJS.eval("'hello'") assert_equal ["red", "yellow", "blue"], ExecJS.eval("'red yellow blue'.split(' ')") assert_equal({"a"=>1,"b"=>2}, ExecJS.eval("{a:1,b:2}")) assert_equal({"a"=>true}, ExecJS.eval("{a:true,b:function (){}}")) assert_equal "café", ExecJS.eval("'café'") assert_equal "☃", ExecJS.eval('"☃"') assert_equal "☃", ExecJS.eval('"\u2603"') assert_equal "\\", ExecJS.eval('"\\\\"') end if defined? Encoding def test_encoding utf8 = Encoding.find('UTF-8') assert_equal utf8, ExecJS.exec("return 'hello'").encoding assert_equal utf8, ExecJS.eval("'☃'").encoding ascii = "'hello'".encode('US-ASCII') result = ExecJS.eval(ascii) assert_equal "hello", result assert_equal utf8, result.encoding assert_raise Encoding::UndefinedConversionError do binary = "\xde\xad\xbe\xef".force_encoding("BINARY") ExecJS.eval(binary) end end def test_encoding_compile utf8 = Encoding.find('UTF-8') context = ExecJS.compile("foo = function(v) { return '¶' + v; }".encode("ISO8859-15")) assert_equal utf8, context.exec("return foo('hello')").encoding assert_equal utf8, context.eval("foo('☃')").encoding ascii = "foo('hello')".encode('US-ASCII') result = context.eval(ascii) assert_equal "¶hello", result assert_equal utf8, result.encoding assert_raise Encoding::UndefinedConversionError do binary = "\xde\xad\xbe\xef".force_encoding("BINARY") context.eval(binary) end end end def test_compile context = ExecJS.compile("foo = function() { return \"bar\"; }") assert_equal "bar", context.exec("return foo()") assert_equal "bar", context.eval("foo()") assert_equal "bar", context.call("foo") end def test_this_is_global_scope assert_equal true, ExecJS.eval("this === (function() {return this})()") assert_equal true, ExecJS.exec("return this === (function() {return this})()") end def test_commonjs_vars_are_undefined assert ExecJS.eval("typeof module == 'undefined'") assert ExecJS.eval("typeof exports == 'undefined'") assert ExecJS.eval("typeof require == 'undefined'") end def test_console_is_undefined assert ExecJS.eval("typeof console == 'undefined'") end def test_compile_large_scripts body = "var foo = 'bar';\n" * 100_000 assert ExecJS.exec("function foo() {\n#{body}\n};\nreturn true") end def test_syntax_error assert_raise ExecJS::RuntimeError do ExecJS.exec(")") end end def test_thrown_exception assert_raise ExecJS::ProgramError do ExecJS.exec("throw 'hello'") end end end debian/source/0000755000000000000000000000000011772460315010474 5ustar debian/source/format0000644000000000000000000000001411772460315011702 0ustar 3.0 (quilt) debian/watch0000644000000000000000000000014111772460315010221 0ustar version=3 http://pkg-ruby-extras.alioth.debian.org/cgi-bin/gemwatch/execjs .*/execjs-(.*).tar.gz