boojs 0.0.24 → 0.0.25

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 22292038de6abe37edfa7087617f08fc71557e58
4
- data.tar.gz: 7054387faa3a784c8731a9bcbee3d5c143fa25a2
3
+ metadata.gz: 193292e66911d83904cd410eebf9404518ca2758
4
+ data.tar.gz: 35c56fa2c34e3224de29e58582dd4873c5f3df66
5
5
  SHA512:
6
- metadata.gz: 0a0edf7bb74c3acc88c0671350fd948106fc41068f68060cc44600306f74d5b87f5957fd519112e5697ebfe3919cdf330f740f6aba9b4d177cc004fa5b2a8da3
7
- data.tar.gz: 1ecf4beff8b3712e12fc5bd07d803b274ebbe5cbb0f6d0f0ac128a2c45815e129153c48e2c5e3e5b2b2380cc1f1eabffea063ff8e5758de3c72742ef50839d2a
6
+ metadata.gz: e7c16d778e4f3392408a2f9605541ddf7b100b2dfce723443c262d6233185f13141f1b9a456b527d01ac666947ca4ac9f0ee3ddb8d56a759488dbd6171b2a7a2
7
+ data.tar.gz: 4580513131b33187c4a8d2f8e489a353a4b7d89ccb72bb7dc62aba7737c2adbb947c228f75f533ffaf638d1cd77cdd85f5fcb595a791c69a225e5b04013b0b75
data/README.md CHANGED
@@ -60,8 +60,9 @@ Verify that a file contains no javascript runtime initialization errors
60
60
  0
61
61
  ```
62
62
 
63
- #### Additional notes
63
+ #### NOTES
64
64
  * Calling `booPing()` will immediately return `"pong"` to `stdout`. You may use this to know when boo has started up fully.
65
+ * `console.error(msg)` will output to stderr. `console.log(msg) will output to stodut`
65
66
 
66
67
  ## Requirements
67
68
 
data/lib/boojs/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module BooJS
2
- VERSION = '0.0.24'
2
+ VERSION = '0.0.25'
3
3
  end
data/lib/boojs.rb CHANGED
@@ -88,6 +88,10 @@ module BooJS
88
88
  phantom.exit(1);
89
89
  }
90
90
 
91
+ console.error = function(msg) {
92
+ system.stderr.writeLine(msg)
93
+ };
94
+
91
95
  function booPing() {
92
96
  console.log("pong");
93
97
  }
@@ -0,0 +1,67 @@
1
+ Dir.chdir File.join File.dirname(__FILE__), '../'
2
+ require 'open3'
3
+
4
+ #Some things need to be re-exported into the JS Interface, e.g. console.error
5
+ RSpec.describe "JS Functions" do
6
+ it "console.error writes to stderr" do
7
+ @err = StringIO.new
8
+ @out = StringIO.new
9
+
10
+ pipe = Open3.popen3("ruby -Ilib ./bin/boojs") do |i, o, e, t|
11
+ begin
12
+ Timeout::timeout(5) do
13
+ i.puts "console.error('hello world')"
14
+ loop do
15
+ res = select [o, e], []
16
+
17
+ if res[0].include? e
18
+ @err.write e.readline
19
+ end
20
+
21
+ if res[0].include? o
22
+ @out.write o.readline
23
+ end
24
+ end
25
+ end
26
+ rescue Timeout::Error
27
+ rescue EOFError
28
+ ensure
29
+ begin
30
+ Process.kill(:KILL, t[:pid])
31
+ rescue Errno::ESRCH
32
+ end
33
+ end
34
+
35
+ expect(@out.string.strip).to eq("")
36
+ expect(@err.string.strip).to eq("hello world")
37
+ end
38
+ end
39
+
40
+ it "booPing writes 'pong' to stdout" do
41
+ @out = StringIO.new
42
+
43
+ pipe = Open3.popen3("ruby -Ilib ./bin/boojs") do |i, o, e, t|
44
+ begin
45
+ Timeout::timeout(5) do
46
+ i.puts "booPing()"
47
+ loop do
48
+ res = select [o], []
49
+
50
+ if res[0].include? o
51
+ @out.write o.readline
52
+ end
53
+ end
54
+ end
55
+ rescue Timeout::Error
56
+ rescue EOFError
57
+ ensure
58
+ begin
59
+ Process.kill(:KILL, t[:pid])
60
+ rescue Errno::ESRCH
61
+ end
62
+ end
63
+
64
+ expect(@out.string.strip).to eq("pong")
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,22 @@
1
+ RSpec.describe "Speed" do
2
+ it "can startup and respond to a ping in under a second via stdin" do
3
+ begin
4
+ begin
5
+ Timeout.timeout(3) do
6
+ IO.popen "ruby -Ilib ./bin/boojs", "r+" do |p|
7
+ begin
8
+ p.puts "booPing()"
9
+ @res = p.readline.strip
10
+ ensure
11
+ Process.kill 9, p.pid
12
+ end
13
+ end
14
+ end
15
+ rescue
16
+ end
17
+
18
+ expect(@res).to eq("pong")
19
+ ensure
20
+ end
21
+ end
22
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: boojs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.24
4
+ version: 0.0.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - seo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-24 00:00:00.000000000 Z
11
+ date: 2015-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -142,12 +142,14 @@ files:
142
142
  - lib/boojs/version.rb
143
143
  - logo.png
144
144
  - spec/cli_spec.rb
145
+ - spec/functions_spec.rb
145
146
  - spec/helpers.rb
146
147
  - spec/ping_spec.rb
147
148
  - spec/sample_spec.rb
148
149
  - spec/samples/jquery_ajax.js
149
150
  - spec/samples/set_a_stdin.js
150
151
  - spec/samples/syntax_problem.js
152
+ - spec/speed_spec.rb
151
153
  - spec/verify_spec.rb
152
154
  - usage.gif
153
155
  homepage: https://github.com/sotownsend/BooJS
@@ -176,10 +178,12 @@ specification_version: 4
176
178
  summary: A boring javascript application framework
177
179
  test_files:
178
180
  - spec/cli_spec.rb
181
+ - spec/functions_spec.rb
179
182
  - spec/helpers.rb
180
183
  - spec/ping_spec.rb
181
184
  - spec/sample_spec.rb
182
185
  - spec/samples/jquery_ajax.js
183
186
  - spec/samples/set_a_stdin.js
184
187
  - spec/samples/syntax_problem.js
188
+ - spec/speed_spec.rb
185
189
  - spec/verify_spec.rb