execjs 2.2.1 → 2.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -141,15 +141,42 @@ module ExecJS
141
141
  end
142
142
  end
143
143
 
144
- def exec_runtime(filename)
145
- io = IO.popen(binary.split(' ') << filename, @popen_options.merge({err: [:child, :out]}))
146
- output = io.read
147
- io.close
144
+ if ExecJS.windows?
145
+ def exec_runtime(filename)
146
+ path = Dir::Tmpname.create(['execjs', 'json']) {}
147
+ begin
148
+ command = binary.split(" ") << filename
149
+ `#{shell_escape(*command)} 2>&1 > #{path}`
150
+ output = File.open(path, 'rb', @popen_options) { |f| f.read }
151
+ ensure
152
+ File.unlink(path) if path
153
+ end
148
154
 
149
- if $?.success?
150
- output
151
- else
152
- raise RuntimeError, output
155
+ if $?.success?
156
+ output
157
+ else
158
+ raise RuntimeError, output
159
+ end
160
+ end
161
+
162
+ def shell_escape(*args)
163
+ # see http://technet.microsoft.com/en-us/library/cc723564.aspx#XSLTsection123121120120
164
+ args.map { |arg|
165
+ arg = %Q("#{arg.gsub('"','""')}") if arg.match(/[&|()<>^ "]/)
166
+ arg
167
+ }.join(" ")
168
+ end
169
+ else
170
+ def exec_runtime(filename)
171
+ io = IO.popen(binary.split(' ') << filename, @popen_options.merge({err: [:child, :out]}))
172
+ output = io.read
173
+ io.close
174
+
175
+ if $?.success?
176
+ output
177
+ else
178
+ raise RuntimeError, output
179
+ end
153
180
  end
154
181
  end
155
182
  # Internally exposed for Context.
@@ -1,3 +1,3 @@
1
1
  module ExecJS
2
- VERSION = "2.2.1"
2
+ VERSION = "2.2.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: execjs
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.2.2
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Sam Stephenson
@@ -9,20 +10,22 @@ authors:
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2014-06-26 00:00:00.000000000 Z
13
+ date: 2014-10-14 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: rake
16
17
  requirement: !ruby/object:Gem::Requirement
18
+ none: false
17
19
  requirements:
18
- - - ">="
20
+ - - ! '>='
19
21
  - !ruby/object:Gem::Version
20
22
  version: '0'
21
23
  type: :development
22
24
  prerelease: false
23
25
  version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
24
27
  requirements:
25
- - - ">="
28
+ - - ! '>='
26
29
  - !ruby/object:Gem::Version
27
30
  version: '0'
28
31
  description: ExecJS lets you run JavaScript code from Ruby.
@@ -33,9 +36,8 @@ executables: []
33
36
  extensions: []
34
37
  extra_rdoc_files: []
35
38
  files:
36
- - LICENSE
37
39
  - README.md
38
- - lib/execjs.rb
40
+ - LICENSE
39
41
  - lib/execjs/disabled_runtime.rb
40
42
  - lib/execjs/encoding.rb
41
43
  - lib/execjs/external_runtime.rb
@@ -52,28 +54,30 @@ files:
52
54
  - lib/execjs/support/node_runner.js
53
55
  - lib/execjs/support/spidermonkey_runner.js
54
56
  - lib/execjs/version.rb
57
+ - lib/execjs.rb
55
58
  homepage: https://github.com/sstephenson/execjs
56
59
  licenses:
57
60
  - MIT
58
- metadata: {}
59
61
  post_install_message:
60
62
  rdoc_options: []
61
63
  require_paths:
62
64
  - lib
63
65
  required_ruby_version: !ruby/object:Gem::Requirement
66
+ none: false
64
67
  requirements:
65
- - - ">="
68
+ - - ! '>='
66
69
  - !ruby/object:Gem::Version
67
70
  version: '0'
68
71
  required_rubygems_version: !ruby/object:Gem::Requirement
72
+ none: false
69
73
  requirements:
70
- - - ">="
74
+ - - ! '>='
71
75
  - !ruby/object:Gem::Version
72
76
  version: '0'
73
77
  requirements: []
74
78
  rubyforge_project:
75
- rubygems_version: 2.2.2
79
+ rubygems_version: 1.8.23
76
80
  signing_key:
77
- specification_version: 4
81
+ specification_version: 3
78
82
  summary: Run JavaScript code from Ruby
79
83
  test_files: []
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 0b1d56b21da3481648cac08369b1fa6821684455
4
- data.tar.gz: 0a25075f34f411486d48cac96691ac36c47742d8
5
- SHA512:
6
- metadata.gz: c49342ff963ad56d908f4a972d902c510b2e0b245668a506a59c82ce849d1a6876d3104749fa41264917ec9e6bd95738317be017ac453822f4793d0125da3ff3
7
- data.tar.gz: d1ef35a999c98687af0e3679896c67bf6f41f4ef33e91e4088caecd8a9fcd2159334aec3a97f0fe029959a5e08f28db8ef2bb0096dff52acb03bdba824a87fa4