akephalos2 2.0.6 → 2.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +57 -53
- data/bin/akephalos +9 -8
- data/lib/akephalos/htmlunit.rb +1 -7
- data/lib/akephalos/version.rb +1 -1
- metadata +12 -12
data/README.md
CHANGED
@@ -49,11 +49,10 @@ We use GitHub issues:
|
|
49
49
|
</a>
|
50
50
|
|
51
51
|
``` bash
|
52
|
-
git clone https://github.com/Nerian/akephalos2
|
53
|
-
git submodule update --init
|
52
|
+
git clone --recursive https://github.com/Nerian/akephalos2
|
54
53
|
```
|
55
54
|
|
56
|
-
The
|
55
|
+
The HTMLUnit files are located at [https://github.com/Nerian/html-unit-vendor](https://github.com/Nerian/html-unit-vendor) and are automatically downloaded as a submodule.
|
57
56
|
|
58
57
|
Also, we have a .rvmrc file already cooked:
|
59
58
|
|
@@ -83,15 +82,20 @@ Here's some sample RSpec code:
|
|
83
82
|
|
84
83
|
``` ruby
|
85
84
|
describe "Home Page" do
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
85
|
+
before { visit "/" }
|
86
|
+
|
87
|
+
context "searching" do
|
88
|
+
|
89
|
+
before do
|
90
|
+
fill_in "Search", :with => "akephalos"
|
91
|
+
click_button "Go"
|
92
|
+
end
|
93
|
+
|
94
|
+
it "returns results" { page.should have_css("#results") }
|
95
|
+
|
96
|
+
it "includes the search term" { page.should have_content("akephalos") }
|
97
|
+
end
|
98
|
+
|
95
99
|
end
|
96
100
|
```
|
97
101
|
|
@@ -102,9 +106,9 @@ Capybara allows you to perform your action on a context, for example inside a di
|
|
102
106
|
<p id="test">Test</p>
|
103
107
|
<iframe id="first" src="/one_text"></iframe>
|
104
108
|
<p id="test2">Test2</p>
|
105
|
-
|
106
|
-
|
107
|
-
|
109
|
+
<iframe class="second" src="/two_text"></iframe>
|
110
|
+
<p id="test3">Test3</p>
|
111
|
+
<iframe id="third" src="/three_text"></iframe>
|
108
112
|
</body>
|
109
113
|
```
|
110
114
|
|
@@ -113,12 +117,12 @@ You can operate within the context of iframe `test2` with any of these calls:
|
|
113
117
|
``` ruby
|
114
118
|
# By ID
|
115
119
|
within_frame("test2") do
|
116
|
-
|
120
|
+
....
|
117
121
|
end
|
118
122
|
|
119
123
|
# By index
|
120
124
|
within_frame(1) do
|
121
|
-
|
125
|
+
....
|
122
126
|
end
|
123
127
|
```
|
124
128
|
|
@@ -136,7 +140,7 @@ ENV['akephalos_jvm_max_memory']
|
|
136
140
|
```
|
137
141
|
|
138
142
|
|
139
|
-
The default value is
|
143
|
+
The default value is 128 MB.
|
140
144
|
|
141
145
|
If you use akephalos's bin the parameter `-m [memory]` sets the max memory for the JVM.
|
142
146
|
|
@@ -153,9 +157,9 @@ Firefox 3.6.
|
|
153
157
|
|
154
158
|
``` ruby
|
155
159
|
Capybara.register_driver :akephalos do |app|
|
156
|
-
|
157
|
-
|
158
|
-
|
160
|
+
# available options:
|
161
|
+
# :ie6, :ie7, :ie8, :firefox_3_6
|
162
|
+
Capybara::Driver::Akephalos.new(app, :browser => :ie8)
|
159
163
|
end
|
160
164
|
```
|
161
165
|
|
@@ -164,7 +168,7 @@ end
|
|
164
168
|
|
165
169
|
``` ruby
|
166
170
|
Capybara.register_driver :akephalos do |app|
|
167
|
-
|
171
|
+
Capybara::Driver::Akephalos.new(app, :http_proxy => 'myproxy.com', :http_proxy_port => 8080)
|
168
172
|
end
|
169
173
|
```
|
170
174
|
|
@@ -180,7 +184,7 @@ ignore javascript errors.
|
|
180
184
|
|
181
185
|
``` ruby
|
182
186
|
Capybara.register_driver :akephalos do |app|
|
183
|
-
|
187
|
+
Capybara::Driver::Akephalos.new(app, :validate_scripts => false)
|
184
188
|
end
|
185
189
|
```
|
186
190
|
|
@@ -191,9 +195,9 @@ By default it uses the 'fatal' level. You can change that like this:
|
|
191
195
|
|
192
196
|
``` ruby
|
193
197
|
Capybara.register_driver :akephalos do |app|
|
194
|
-
|
195
|
-
|
196
|
-
|
198
|
+
# available options
|
199
|
+
# "trace", "debug", "info", "warn", "error", or "fatal"
|
200
|
+
Capybara::Driver::Akephalos.new(app, :htmlunit_log_level => 'fatal')
|
197
201
|
end
|
198
202
|
```
|
199
203
|
|
@@ -202,13 +206,13 @@ end
|
|
202
206
|
|
203
207
|
``` ruby
|
204
208
|
Spork.prefork do
|
205
|
-
|
206
|
-
|
209
|
+
...
|
210
|
+
Akephalos::RemoteClient.manager
|
207
211
|
end
|
208
212
|
|
209
213
|
Spork.each_run do
|
210
|
-
|
211
|
-
|
214
|
+
...
|
215
|
+
Thread.current['DRb'] = { 'server' => DRb::DRbServer.new }
|
212
216
|
end
|
213
217
|
```
|
214
218
|
|
@@ -231,13 +235,13 @@ By default, all filtered requests will return an empty body with a 200 status co
|
|
231
235
|
|
232
236
|
``` ruby
|
233
237
|
Akephalos.filter(:get, "http://google.com/missing",
|
234
|
-
|
238
|
+
:status => 404, :body => "... <h1>Not Found</h1> ...")
|
235
239
|
|
236
240
|
Akephalos.filter(:post, "http://my-api.com/resource.xml",
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
+
:status => 201, :headers => {
|
242
|
+
"Content-Type" => "application/xml",
|
243
|
+
"Location" => "http://my-api.com/resources/1.xml" },
|
244
|
+
:body => {:id => 100}.to_xml)
|
241
245
|
```
|
242
246
|
|
243
247
|
|
@@ -249,7 +253,7 @@ Google Analytics code is passively applied based on HTML comments, so simply ret
|
|
249
253
|
|
250
254
|
``` ruby
|
251
255
|
Akephalos.filter(:get, "http://www.google-analytics.com/ga.js",
|
252
|
-
|
256
|
+
:headers => {"Content-Type" => "application/javascript"})
|
253
257
|
```
|
254
258
|
|
255
259
|
|
@@ -257,15 +261,15 @@ Google Maps requires the most extensive amount of API definitions of the three,
|
|
257
261
|
|
258
262
|
``` ruby
|
259
263
|
Akephalos.filter(:get, "http://maps.google.com/maps/api/js?sensor=false",
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
264
|
+
:headers => {"Content-Type" => "application/javascript"},
|
265
|
+
:body => "window.google = {
|
266
|
+
maps: {
|
267
|
+
LatLng: function(){},
|
268
|
+
Map: function(){},
|
269
|
+
Marker: function(){},
|
270
|
+
MapTypeId: {ROADMAP:1}
|
271
|
+
}
|
272
|
+
};")
|
269
273
|
```
|
270
274
|
|
271
275
|
|
@@ -277,9 +281,9 @@ When you enable Facebook Connect on your page, the FeatureLoader is requested, a
|
|
277
281
|
|
278
282
|
``` ruby
|
279
283
|
Akephalos.filter(:get,
|
280
|
-
|
281
|
-
|
282
|
-
|
284
|
+
"http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php",
|
285
|
+
:headers => {"Content-Type" => "application/javascript"},
|
286
|
+
:body => "window.FB_RequireFeatures = function() {};")
|
283
287
|
```
|
284
288
|
|
285
289
|
|
@@ -295,11 +299,11 @@ Running Akephalos in interactive mode gives you an IRB context for interacting w
|
|
295
299
|
|
296
300
|
``` ruby
|
297
301
|
$ akephalos --interactive
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
302
|
+
-> Capybara.app_host # => "http://localhost:3000"
|
303
|
+
-> page.visit "/"
|
304
|
+
-> page.fill_in "Search", :with => "akephalos"
|
305
|
+
-> page.click_button "Go"
|
306
|
+
-> page.has_css?("#search_results") # => true
|
303
307
|
```
|
304
308
|
|
305
309
|
|
data/bin/akephalos
CHANGED
@@ -39,25 +39,25 @@ case
|
|
39
39
|
when options[:use_htmlunit_snapshot]
|
40
40
|
require "fileutils"
|
41
41
|
|
42
|
-
FileUtils.mkdir_p("vendor/
|
43
|
-
Dir["vendor/
|
42
|
+
FileUtils.mkdir_p("vendor/html-unit")
|
43
|
+
Dir["vendor/html-unit/*.jar"].each { |jar| File.unlink(jar) }
|
44
44
|
|
45
45
|
Dir.chdir("vendor") do
|
46
46
|
$stdout.print "Downloading latest snapshot... "
|
47
47
|
$stdout.flush
|
48
|
-
%x[curl -O http://build.canoo.com/htmlunit/artifacts/htmlunit-2.10-SNAPSHOT-with-dependencies.zip
|
48
|
+
%x[curl -O http://build.canoo.com/htmlunit/artifacts/htmlunit-2.10-SNAPSHOT-with-dependencies.zip]
|
49
49
|
puts "done"
|
50
50
|
|
51
51
|
$stdout.print "Extracting dependencies... "
|
52
52
|
$stdout.flush
|
53
|
-
%x[unzip -j -d
|
53
|
+
%x[unzip -j -d html-unit htmlunit-2.10-SNAPSHOT-with-dependencies.zip htmlunit-2.10-SNAPSHOT/lib htmlunit-2.10-SNAPSHOT/lib/* &> /dev/null]
|
54
54
|
puts "done"
|
55
55
|
|
56
56
|
File.unlink "htmlunit-2.10-SNAPSHOT-with-dependencies.zip"
|
57
57
|
end
|
58
58
|
|
59
59
|
$stdout.puts "="*40
|
60
|
-
$stdout.puts "The latest HtmlUnit snapshot has been extracted to vendor/
|
60
|
+
$stdout.puts "The latest HtmlUnit snapshot has been extracted to vendor/html-unit!"
|
61
61
|
when options[:interactive]
|
62
62
|
$LOAD_PATH.unshift('vendor', lib, src)
|
63
63
|
require 'akephalos'
|
@@ -82,7 +82,8 @@ else
|
|
82
82
|
java_args = [
|
83
83
|
"-Xmx#{options[:akephalos_jvm_max_memory]}M",
|
84
84
|
"-cp", [JRubyJars.core_jar_path, JRubyJars.stdlib_jar_path].join(File::PATH_SEPARATOR),
|
85
|
-
"org.jruby.Main"
|
85
|
+
"org.jruby.Main",
|
86
|
+
"-X+O"
|
86
87
|
]
|
87
88
|
ruby_args = [
|
88
89
|
"-Ku",
|
@@ -95,7 +96,7 @@ else
|
|
95
96
|
# since the akephalos server doesn't have any gem dependencies and is
|
96
97
|
# always executed with the same context, we clear RUBYOPT before running
|
97
98
|
# exec.
|
98
|
-
ENV["RUBYOPT"] = ""
|
99
|
-
exec("java", *(java_args + ruby_args))
|
99
|
+
ENV["RUBYOPT"] = "--1.9"
|
100
|
+
exec("java", *(java_args + ruby_args))
|
100
101
|
end
|
101
102
|
end
|
data/lib/akephalos/htmlunit.rb
CHANGED
@@ -1,13 +1,7 @@
|
|
1
1
|
require "pathname"
|
2
2
|
require "java"
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
raise "Could not find html-unit/htmlunit-VERSION.jar in load path:\n [ #{$LOAD_PATH.join(",\n ")}\n ]" unless dependency_directory
|
7
|
-
|
8
|
-
Dir[File.join(dependency_directory, "html-unit/*.jar")].each do |jar|
|
9
|
-
require jar
|
10
|
-
end
|
4
|
+
Dir[File.dirname(__FILE__) + "/../.." + "/vendor/html-unit/*.jar"].each {|file| require file }
|
11
5
|
|
12
6
|
java.lang.System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog")
|
13
7
|
java.lang.System.setProperty("org.apache.commons.logging.simplelog.defaultlog", "fatal")
|
data/lib/akephalos/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: akephalos2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-10-
|
12
|
+
date: 2011-10-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: capybara
|
16
|
-
requirement: &
|
16
|
+
requirement: &70282312283800 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70282312283800
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &70282312282580 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70282312282580
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: jruby-jars
|
38
|
-
requirement: &
|
38
|
+
requirement: &70282312280200 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70282312280200
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: sinatra
|
49
|
-
requirement: &
|
49
|
+
requirement: &70282312294200 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70282312294200
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rspec
|
60
|
-
requirement: &
|
60
|
+
requirement: &70282312291200 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70282312291200
|
69
69
|
description: Headless Browser for Integration Testing with Capybara
|
70
70
|
email: bj.schaefer@gmail.com
|
71
71
|
executables:
|