execjs 1.2.4 → 1.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/execjs/external_runtime.rb +26 -3
- data/lib/execjs/runtimes.rb +3 -2
- data/lib/execjs/support/node_runner.js +1 -1
- data/lib/execjs/version.rb +1 -1
- metadata +112 -74
@@ -91,6 +91,7 @@ module ExecJS
|
|
91
91
|
@runner_path = options[:runner_path]
|
92
92
|
@test_args = options[:test_args]
|
93
93
|
@test_match = options[:test_match]
|
94
|
+
@encoding = options[:encoding]
|
94
95
|
@binary = locate_binary
|
95
96
|
end
|
96
97
|
|
@@ -119,8 +120,7 @@ module ExecJS
|
|
119
120
|
end
|
120
121
|
|
121
122
|
def exec_runtime(filename)
|
122
|
-
output =
|
123
|
-
IO.popen("#{@binary} #{filename} 2>&1") { |f| output = f.read }
|
123
|
+
output = sh("#{@binary} #{filename} 2>&1")
|
124
124
|
if $?.success?
|
125
125
|
output
|
126
126
|
else
|
@@ -143,7 +143,7 @@ module ExecJS
|
|
143
143
|
Array(command).each do |name|
|
144
144
|
name, args = name.split(/\s+/, 2)
|
145
145
|
result = if ExecJS.windows?
|
146
|
-
|
146
|
+
`"#{ExecJS.root}/support/which.bat" #{name}`
|
147
147
|
else
|
148
148
|
`command -v #{name} 2>/dev/null`
|
149
149
|
end
|
@@ -154,5 +154,28 @@ module ExecJS
|
|
154
154
|
end
|
155
155
|
nil
|
156
156
|
end
|
157
|
+
|
158
|
+
if "".respond_to?(:force_encoding)
|
159
|
+
def sh(command)
|
160
|
+
output, options = nil, {}
|
161
|
+
options[:external_encoding] = @encoding if @encoding
|
162
|
+
options[:internal_encoding] = Encoding.default_internal || 'UTF-8'
|
163
|
+
IO.popen(command, options) { |f| output = f.read }
|
164
|
+
output
|
165
|
+
end
|
166
|
+
else
|
167
|
+
require "iconv"
|
168
|
+
|
169
|
+
def sh(command)
|
170
|
+
output = nil
|
171
|
+
IO.popen(command) { |f| output = f.read }
|
172
|
+
|
173
|
+
if @encoding
|
174
|
+
Iconv.new('UTF-8', @encoding).iconv(output)
|
175
|
+
else
|
176
|
+
output
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
157
180
|
end
|
158
181
|
end
|
data/lib/execjs/runtimes.rb
CHANGED
@@ -35,8 +35,9 @@ module ExecJS
|
|
35
35
|
|
36
36
|
JScript = ExternalRuntime.new(
|
37
37
|
:name => "JScript",
|
38
|
-
:command => "cscript //E:jscript //Nologo",
|
39
|
-
:runner_path => ExecJS.root + "/support/jscript_runner.js"
|
38
|
+
:command => "cscript //E:jscript //Nologo //U",
|
39
|
+
:runner_path => ExecJS.root + "/support/jscript_runner.js",
|
40
|
+
:encoding => 'UTF-16LE' # CScript with //U returns UTF-16LE
|
40
41
|
)
|
41
42
|
|
42
43
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
(function(program, execJS
|
1
|
+
(function(program, execJS) { execJS(program) })(function(module, exports, require) { #{source}
|
2
2
|
}, function(program) {
|
3
3
|
var output, print = function(string) {
|
4
4
|
process.stdout.write('' + string);
|
data/lib/execjs/version.rb
CHANGED
metadata
CHANGED
@@ -1,98 +1,125 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: execjs
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 2
|
9
|
+
- 5
|
10
|
+
version: 1.2.5
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Sam Stephenson
|
9
14
|
- Josh Peek
|
10
15
|
autorequire:
|
11
16
|
bindir: bin
|
12
17
|
cert_chain: []
|
13
|
-
|
14
|
-
|
15
|
-
|
18
|
+
|
19
|
+
date: 2011-09-12 00:00:00 -05:00
|
20
|
+
default_executable:
|
21
|
+
dependencies:
|
22
|
+
- !ruby/object:Gem::Dependency
|
16
23
|
name: multi_json
|
17
|
-
|
24
|
+
prerelease: false
|
25
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
18
26
|
none: false
|
19
|
-
requirements:
|
27
|
+
requirements:
|
20
28
|
- - ~>
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
hash: 15
|
31
|
+
segments:
|
32
|
+
- 1
|
33
|
+
- 0
|
34
|
+
version: "1.0"
|
23
35
|
type: :runtime
|
24
|
-
|
25
|
-
|
26
|
-
- !ruby/object:Gem::Dependency
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
27
38
|
name: johnson
|
28
|
-
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
29
41
|
none: false
|
30
|
-
requirements:
|
31
|
-
- -
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 3
|
46
|
+
segments:
|
47
|
+
- 0
|
48
|
+
version: "0"
|
34
49
|
type: :development
|
35
|
-
|
36
|
-
|
37
|
-
- !ruby/object:Gem::Dependency
|
50
|
+
version_requirements: *id002
|
51
|
+
- !ruby/object:Gem::Dependency
|
38
52
|
name: mustang
|
39
|
-
|
53
|
+
prerelease: false
|
54
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
40
55
|
none: false
|
41
|
-
requirements:
|
42
|
-
- -
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
hash: 3
|
60
|
+
segments:
|
61
|
+
- 0
|
62
|
+
version: "0"
|
45
63
|
type: :development
|
46
|
-
|
47
|
-
|
48
|
-
- !ruby/object:Gem::Dependency
|
64
|
+
version_requirements: *id003
|
65
|
+
- !ruby/object:Gem::Dependency
|
49
66
|
name: rake
|
50
|
-
|
67
|
+
prerelease: false
|
68
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
51
69
|
none: false
|
52
|
-
requirements:
|
53
|
-
- -
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
hash: 3
|
74
|
+
segments:
|
75
|
+
- 0
|
76
|
+
version: "0"
|
56
77
|
type: :development
|
57
|
-
|
58
|
-
|
59
|
-
- !ruby/object:Gem::Dependency
|
78
|
+
version_requirements: *id004
|
79
|
+
- !ruby/object:Gem::Dependency
|
60
80
|
name: therubyracer
|
61
|
-
|
81
|
+
prerelease: false
|
82
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
62
83
|
none: false
|
63
|
-
requirements:
|
64
|
-
- -
|
65
|
-
- !ruby/object:Gem::Version
|
66
|
-
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
hash: 3
|
88
|
+
segments:
|
89
|
+
- 0
|
90
|
+
version: "0"
|
67
91
|
type: :development
|
68
|
-
|
69
|
-
|
70
|
-
- !ruby/object:Gem::Dependency
|
92
|
+
version_requirements: *id005
|
93
|
+
- !ruby/object:Gem::Dependency
|
71
94
|
name: therubyrhino
|
72
|
-
|
95
|
+
prerelease: false
|
96
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
73
97
|
none: false
|
74
|
-
requirements:
|
75
|
-
- -
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
hash: 3
|
102
|
+
segments:
|
103
|
+
- 0
|
104
|
+
version: "0"
|
78
105
|
type: :development
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
'
|
84
|
-
email:
|
106
|
+
version_requirements: *id006
|
107
|
+
description: " ExecJS lets you run JavaScript code from Ruby.\n"
|
108
|
+
email:
|
85
109
|
- sstephenson@gmail.com
|
86
110
|
- josh@joshpeek.com
|
87
111
|
executables: []
|
112
|
+
|
88
113
|
extensions: []
|
114
|
+
|
89
115
|
extra_rdoc_files: []
|
90
|
-
|
91
|
-
|
116
|
+
|
117
|
+
files:
|
118
|
+
- README.md
|
119
|
+
- LICENSE
|
92
120
|
- lib/execjs/external_runtime.rb
|
93
121
|
- lib/execjs/johnson_runtime.rb
|
94
122
|
- lib/execjs/module.rb
|
95
|
-
- lib/execjs/version.rb
|
96
123
|
- lib/execjs/mustang_runtime.rb
|
97
124
|
- lib/execjs/ruby_racer_runtime.rb
|
98
125
|
- lib/execjs/ruby_rhino_runtime.rb
|
@@ -103,30 +130,41 @@ files:
|
|
103
130
|
- lib/execjs/support/json2.js
|
104
131
|
- lib/execjs/support/node_runner.js
|
105
132
|
- lib/execjs/support/which.bat
|
106
|
-
-
|
107
|
-
-
|
133
|
+
- lib/execjs/version.rb
|
134
|
+
- lib/execjs.rb
|
135
|
+
has_rdoc: true
|
108
136
|
homepage: https://github.com/sstephenson/execjs
|
109
137
|
licenses: []
|
138
|
+
|
110
139
|
post_install_message:
|
111
140
|
rdoc_options: []
|
112
|
-
|
141
|
+
|
142
|
+
require_paths:
|
113
143
|
- lib
|
114
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
144
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
115
145
|
none: false
|
116
|
-
requirements:
|
117
|
-
- -
|
118
|
-
- !ruby/object:Gem::Version
|
119
|
-
|
120
|
-
|
146
|
+
requirements:
|
147
|
+
- - ">="
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
hash: 3
|
150
|
+
segments:
|
151
|
+
- 0
|
152
|
+
version: "0"
|
153
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
154
|
none: false
|
122
|
-
requirements:
|
123
|
-
- -
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
|
155
|
+
requirements:
|
156
|
+
- - ">="
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
hash: 3
|
159
|
+
segments:
|
160
|
+
- 0
|
161
|
+
version: "0"
|
126
162
|
requirements: []
|
163
|
+
|
127
164
|
rubyforge_project:
|
128
|
-
rubygems_version: 1.
|
165
|
+
rubygems_version: 1.5.2
|
129
166
|
signing_key:
|
130
167
|
specification_version: 3
|
131
168
|
summary: Run JavaScript code from Ruby
|
132
169
|
test_files: []
|
170
|
+
|