execjs 1.4.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f4dc71e89b01c1335680209ad2e9cd1adc2564df
4
+ data.tar.gz: 8f0fa816bc85914127a1ccddf15595025311ad41
5
+ SHA512:
6
+ metadata.gz: c43fe65595fdb4867941286a8293f256bee306d302c5a0ee9a9263902054c9d42831aad75b2a2a2ec932cad55ae7180bd801c51de203d1605b831c05a29ddd2b
7
+ data.tar.gz: 4a878ca1119bcdab94a4d66989e50683fcb296bb1137e26659d1517b9ed36f97ab6655e03f0b5c0270907610f54260622e225fde5daedfd4595ffaa616ad4f8c
data/LICENSE CHANGED
@@ -1,5 +1,5 @@
1
- Copyright (c) 2011 Sam Stephenson
2
- Copyright (c) 2011 Josh Peek
1
+ Copyright (c) 2013 Sam Stephenson
2
+ Copyright (c) 2013 Josh Peek
3
3
 
4
4
  Permission is hereby granted, free of charge, to any person obtaining
5
5
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -37,6 +37,6 @@ A longer example, demonstrating how to invoke the CoffeeScript compiler:
37
37
 
38
38
  # License
39
39
 
40
- Copyright (c) 2011 Sam Stephenson and Josh Peek.
40
+ Copyright (c) 2013 Sam Stephenson and Josh Peek.
41
41
 
42
42
  Released under the MIT license. See `LICENSE` for details.
@@ -16,7 +16,7 @@ module ExecJS
16
16
  source = encode(source)
17
17
 
18
18
  if /\S/ =~ source
19
- exec("return eval(#{JSON.encode("(#{source})")})")
19
+ exec("return eval(#{::JSON.dump("(#{source})")})")
20
20
  end
21
21
  end
22
22
 
@@ -30,7 +30,7 @@ module ExecJS
30
30
  end
31
31
 
32
32
  def call(identifier, *args)
33
- eval "#{identifier}.apply(this, #{JSON.encode(args)})"
33
+ eval "#{identifier}.apply(this, #{::JSON.dump(args)})"
34
34
  end
35
35
 
36
36
  protected
@@ -50,7 +50,7 @@ module ExecJS
50
50
  end
51
51
  output.sub!('#{encoded_source}') do
52
52
  encoded_source = encode_unicode_codepoints(source)
53
- JSON.encode("(function(){ #{encoded_source} })()")
53
+ ::JSON.dump("(function(){ #{encoded_source} })()")
54
54
  end
55
55
  output.sub!('#{json2_source}') do
56
56
  IO.read(ExecJS.root + "/support/json2.js")
@@ -59,7 +59,7 @@ module ExecJS
59
59
  end
60
60
 
61
61
  def extract_result(output)
62
- status, value = output.empty? ? [] : JSON.decode(output)
62
+ status, value = output.empty? ? [] : ::JSON.load(output)
63
63
  if status == "ok"
64
64
  value
65
65
  elsif value =~ /SyntaxError:/
@@ -100,7 +100,7 @@ module ExecJS
100
100
  end
101
101
 
102
102
  def available?
103
- require "execjs/json"
103
+ require 'json'
104
104
  binary ? true : false
105
105
  end
106
106
 
@@ -134,33 +134,12 @@ module ExecJS
134
134
  @runner_source ||= IO.read(@runner_path)
135
135
  end
136
136
 
137
- if ExecJS.windows?
138
- def exec_runtime(filename)
139
- path = Dir::Tmpname.create(['execjs', 'json']) {}
140
- begin
141
- `#{shell_escape(*(binary.split(' ') << filename))} 2>&1 > #{path}`
142
- options = {}
143
- options[:external_encoding] = @encoding if @encoding
144
- options[:internal_encoding] = ::Encoding.default_internal || 'UTF-8'
145
- output = File.open(path, 'rb', options) { |f| f.read }
146
- ensure
147
- File.unlink(path) if path
148
- end
149
-
150
- if $?.success?
151
- output
152
- else
153
- raise RuntimeError, output
154
- end
155
- end
156
- else
157
- def exec_runtime(filename)
158
- output = sh("#{shell_escape(*(binary.split(' ') << filename))} 2>&1")
159
- if $?.success?
160
- output
161
- else
162
- raise RuntimeError, output
163
- end
137
+ def exec_runtime(filename)
138
+ output = sh("#{shell_escape(*(binary.split(' ') << filename))} 2>&1")
139
+ if $?.success?
140
+ output
141
+ else
142
+ raise RuntimeError, output
164
143
  end
165
144
  end
166
145
 
@@ -1,3 +1,3 @@
1
1
  module ExecJS
2
- VERSION = "1.4.1"
2
+ VERSION = "2.0.0"
3
3
  end
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: execjs
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
5
- prerelease:
4
+ version: 2.0.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Sam Stephenson
@@ -10,38 +9,20 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2014-10-14 00:00:00.000000000 Z
12
+ date: 2013-08-21 00:00:00.000000000 Z
14
13
  dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: multi_json
17
- requirement: !ruby/object:Gem::Requirement
18
- none: false
19
- requirements:
20
- - - ~>
21
- - !ruby/object:Gem::Version
22
- version: '1.0'
23
- type: :runtime
24
- prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
- requirements:
28
- - - ~>
29
- - !ruby/object:Gem::Version
30
- version: '1.0'
31
14
  - !ruby/object:Gem::Dependency
32
15
  name: rake
33
16
  requirement: !ruby/object:Gem::Requirement
34
- none: false
35
17
  requirements:
36
- - - ! '>='
18
+ - - '>='
37
19
  - !ruby/object:Gem::Version
38
20
  version: '0'
39
21
  type: :development
40
22
  prerelease: false
41
23
  version_requirements: !ruby/object:Gem::Requirement
42
- none: false
43
24
  requirements:
44
- - - ! '>='
25
+ - - '>='
45
26
  - !ruby/object:Gem::Version
46
27
  version: '0'
47
28
  description: ExecJS lets you run JavaScript code from Ruby.
@@ -58,7 +39,6 @@ files:
58
39
  - lib/execjs/encoding.rb
59
40
  - lib/execjs/external_runtime.rb
60
41
  - lib/execjs/johnson_runtime.rb
61
- - lib/execjs/json.rb
62
42
  - lib/execjs/module.rb
63
43
  - lib/execjs/mustang_runtime.rb
64
44
  - lib/execjs/ruby_racer_runtime.rb
@@ -73,27 +53,27 @@ files:
73
53
  - lib/execjs/version.rb
74
54
  - lib/execjs.rb
75
55
  homepage: https://github.com/sstephenson/execjs
76
- licenses: []
56
+ licenses:
57
+ - MIT
58
+ metadata: {}
77
59
  post_install_message:
78
60
  rdoc_options: []
79
61
  require_paths:
80
62
  - lib
81
63
  required_ruby_version: !ruby/object:Gem::Requirement
82
- none: false
83
64
  requirements:
84
- - - ! '>='
65
+ - - '>='
85
66
  - !ruby/object:Gem::Version
86
67
  version: '0'
87
68
  required_rubygems_version: !ruby/object:Gem::Requirement
88
- none: false
89
69
  requirements:
90
- - - ! '>='
70
+ - - '>='
91
71
  - !ruby/object:Gem::Version
92
72
  version: '0'
93
73
  requirements: []
94
74
  rubyforge_project:
95
- rubygems_version: 1.8.23
75
+ rubygems_version: 2.0.2
96
76
  signing_key:
97
- specification_version: 3
77
+ specification_version: 4
98
78
  summary: Run JavaScript code from Ruby
99
79
  test_files: []
data/lib/execjs/json.rb DELETED
@@ -1,23 +0,0 @@
1
- require "multi_json"
2
-
3
- module ExecJS
4
- module JSON
5
- if MultiJson.respond_to?(:dump)
6
- def self.decode(obj)
7
- MultiJson.load(obj)
8
- end
9
-
10
- def self.encode(obj)
11
- MultiJson.dump(obj)
12
- end
13
- else
14
- def self.decode(obj)
15
- MultiJson.decode(obj)
16
- end
17
-
18
- def self.encode(obj)
19
- MultiJson.encode(obj)
20
- end
21
- end
22
- end
23
- end