phantomjs.rb 0.0.4 → 0.0.5
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.
- data/CHANGELOG +5 -0
- data/lib/phantomjs.rb +7 -3
- data/lib/phantomjs/version.rb +1 -1
- data/spec/phantomjs_spec.rb +9 -0
- metadata +8 -2
data/CHANGELOG
CHANGED
data/lib/phantomjs.rb
CHANGED
@@ -13,9 +13,13 @@ module Phantomjs
|
|
13
13
|
def run(script, *args)
|
14
14
|
string_args = args.join(" ")
|
15
15
|
@executable ||= get_executable
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
|
17
|
+
if block_given?
|
18
|
+
IO.popen("#{@executable} #{script} #{string_args}").each_line do |line|
|
19
|
+
yield line
|
20
|
+
end
|
21
|
+
else
|
22
|
+
`#{@executable} #{script} #{string_args}`
|
19
23
|
end
|
20
24
|
end
|
21
25
|
|
data/lib/phantomjs/version.rb
CHANGED
data/spec/phantomjs_spec.rb
CHANGED
@@ -7,5 +7,14 @@ describe Phantomjs do
|
|
7
7
|
result = Phantomjs.run(script, 'foo1', 'foo2')
|
8
8
|
result.should eq("bar foo1 foo2\n")
|
9
9
|
end
|
10
|
+
|
11
|
+
it "accepts a block that will get called for each line of output" do
|
12
|
+
line = ''
|
13
|
+
script = File.expand_path('./spec/runner.js')
|
14
|
+
Phantomjs.run(script, 'foo1', 'foo2') do |l|
|
15
|
+
line << l
|
16
|
+
end
|
17
|
+
line.should eq("bar foo1 foo2\n")
|
18
|
+
end
|
10
19
|
end
|
11
20
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phantomjs.rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-12-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ZenTest
|
@@ -107,12 +107,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
107
107
|
- - ! '>='
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '0'
|
110
|
+
segments:
|
111
|
+
- 0
|
112
|
+
hash: 344941083117915964
|
110
113
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
114
|
none: false
|
112
115
|
requirements:
|
113
116
|
- - ! '>='
|
114
117
|
- !ruby/object:Gem::Version
|
115
118
|
version: '0'
|
119
|
+
segments:
|
120
|
+
- 0
|
121
|
+
hash: 344941083117915964
|
116
122
|
requirements: []
|
117
123
|
rubyforge_project: phantomjs.rb
|
118
124
|
rubygems_version: 1.8.24
|