akephalos2 2.0.9 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +98 -72
- data/bin/akephalos +14 -12
- data/lib/akephalos/client.rb +4 -4
- data/lib/akephalos/htmlunit.rb +1 -1
- data/lib/akephalos/htmlunit_downloader.rb +38 -0
- data/lib/akephalos/version.rb +1 -1
- data/lib/akephalos.rb +1 -0
- data/vendor/html-unit/commons-lang-2.6.jar +0 -0
- data/vendor/html-unit/cssparser-0.9.5.jar +0 -0
- data/vendor/html-unit/htmlunit-2.9.jar +0 -0
- metadata +21 -14
data/README.md
CHANGED
@@ -1,28 +1,30 @@
|
|
1
1
|
# Important Notice
|
2
2
|
|
3
|
-
This repo has rewritten its history and as such is not compatible with the main Akephalos repo.
|
4
|
-
|
3
|
+
This repo has rewritten its history and as such is not compatible with the main Akephalos repo.
|
4
|
+
|
5
5
|
You can get the unaltered – before history rewrite – pristine copy at: [https://github.com/Nerian/akephalos](https://github.com/Nerian/akephalos)
|
6
6
|
|
7
7
|
Further development will be done here:
|
8
8
|
[https://github.com/Nerian/akephalos2](https://github.com/Nerian/akephalos2)
|
9
9
|
|
10
|
-
|
10
|
+
Its history was rewritten in order to remove .jar vendor files that were making its size huge.
|
11
11
|
|
12
12
|
|
13
|
-
# Akephalos
|
13
|
+
# Akephalos
|
14
14
|
|
15
15
|
Akephalos is a full-stack headless browser for integration testing with
|
16
16
|
[Capybara](https://github.com/jnicklas/capybara). It is built on top of [HtmlUnit](http://htmlunit.sourceforge.net),
|
17
17
|
a GUI-less browser for the Java platform, but can be run on both JRuby and
|
18
18
|
MRI with no need for JRuby to be installed on the system.
|
19
19
|
|
20
|
+
The name Akephalos /ā-sĕf'ə-ləs/ comes from the Greek ἀκέφαλος akephalos, which literally means "headless".
|
21
|
+
|
20
22
|
|
21
23
|
## Installation
|
22
|
-
|
24
|
+
|
23
25
|
``` ruby
|
24
26
|
gem install akephalos2
|
25
|
-
```
|
27
|
+
```
|
26
28
|
|
27
29
|
Or
|
28
30
|
|
@@ -30,18 +32,26 @@ Or
|
|
30
32
|
gem 'akephalos2', :require => 'akephalos'
|
31
33
|
```
|
32
34
|
|
33
|
-
Or (for the current master branch)
|
35
|
+
Or (for the current master branch)
|
34
36
|
|
35
37
|
``` ruby
|
36
|
-
gem '
|
38
|
+
gem 'akephalos2', :git => 'git://github.com/Nerian/akephalos2.git'
|
37
39
|
```
|
38
40
|
|
41
|
+
Akephalos creates a `.akephalos` folder where it stores HTMLUnit binaries. You should set Git to ignore that folder.
|
42
|
+
|
43
|
+
```
|
44
|
+
git ignore .akephalos
|
45
|
+
```
|
46
|
+
|
47
|
+
|
39
48
|
# Questions, bugs, etc:
|
40
49
|
|
41
50
|
We use GitHub issues:
|
42
51
|
|
43
52
|
[https://github.com/Nerian/akephalos2/issues](https://github.com/Nerian/akephalos2/issues)
|
44
53
|
|
54
|
+
|
45
55
|
# Development
|
46
56
|
|
47
57
|
<a href='http://travis-ci.org/#!/Nerian/akephalos2'>
|
@@ -49,17 +59,16 @@ We use GitHub issues:
|
|
49
59
|
</a>
|
50
60
|
|
51
61
|
``` bash
|
52
|
-
git clone
|
62
|
+
git clone https://github.com/Nerian/akephalos2
|
53
63
|
```
|
54
64
|
|
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.
|
56
|
-
|
57
65
|
Also, we have a .rvmrc file already cooked:
|
58
66
|
|
59
67
|
``` bash
|
60
68
|
cp .rvmrc.example .rvmrc
|
61
69
|
```
|
62
|
-
|
70
|
+
|
71
|
+
|
63
72
|
## Setup
|
64
73
|
|
65
74
|
Configuring akephalos is as simple as requiring it and setting Capybara's
|
@@ -70,6 +79,7 @@ require 'akephalos'
|
|
70
79
|
Capybara.javascript_driver = :akephalos
|
71
80
|
```
|
72
81
|
|
82
|
+
|
73
83
|
## Basic Usage
|
74
84
|
|
75
85
|
Akephalos provides a driver for Capybara, so using Akephalos is no
|
@@ -79,28 +89,29 @@ makes no assumptions about the testing framework being used, and works with
|
|
79
89
|
RSpec, Cucumber, and Test::Unit.
|
80
90
|
|
81
91
|
Here's some sample RSpec code:
|
82
|
-
|
92
|
+
|
83
93
|
``` ruby
|
84
94
|
# encoding: utf-8
|
85
95
|
|
86
96
|
describe "Home Page" do
|
87
97
|
before { visit "/" }
|
88
|
-
|
98
|
+
|
89
99
|
context "searching" do
|
90
|
-
|
100
|
+
|
91
101
|
before do
|
92
|
-
fill_in "Search", :with => "akephalos"
|
102
|
+
fill_in "Search", :with => "akephalos"
|
93
103
|
click_button "Go"
|
94
104
|
end
|
95
|
-
|
105
|
+
|
96
106
|
it "returns results" { page.should have_css("#results") }
|
97
|
-
|
107
|
+
|
98
108
|
it "includes the search term" { page.should have_content("akephalos") }
|
99
109
|
end
|
100
|
-
|
101
|
-
end
|
110
|
+
|
111
|
+
end
|
102
112
|
```
|
103
113
|
|
114
|
+
|
104
115
|
### Encoding
|
105
116
|
|
106
117
|
Akephalos uses UTF-8 encoding by default. You may need to add `# encoding: utf-8` at the first line of your test. This behavior is the default using JRuby in 1.9 mode, but you can use JRuby in 1.8 mode by setting the environment variable `ENV['JRUBY_1_8']=true`. Note that Akephalos works with MRI. I refer here to the JRuby that is used internally by Akephalos.
|
@@ -138,25 +149,39 @@ end
|
|
138
149
|
## Configuration
|
139
150
|
|
140
151
|
There are now a few configuration options available through Capybara's new
|
141
|
-
`register_driver` API.
|
152
|
+
`register_driver` API.
|
153
|
+
|
142
154
|
|
143
|
-
###
|
155
|
+
### Configure the max memory that Java Virtual Machine can use
|
144
156
|
|
145
157
|
The max memory that the JVM is going to use can be set using an environment variable in your spec_helper or .bashrc file.
|
146
158
|
|
147
|
-
``` ruby
|
159
|
+
``` ruby
|
148
160
|
ENV['akephalos_jvm_max_memory']
|
149
|
-
```
|
150
|
-
|
161
|
+
```
|
162
|
+
|
151
163
|
|
152
164
|
The default value is 128 MB.
|
153
165
|
|
154
|
-
If you use
|
166
|
+
If you use Akephalos's bin the parameter `-m [memory]` sets the max memory for the JVM.
|
155
167
|
|
156
168
|
``` bash
|
157
169
|
$ akephalos -m 670
|
158
|
-
```
|
170
|
+
```
|
171
|
+
|
172
|
+
|
173
|
+
### Configure the version of HTMLUnit
|
174
|
+
|
175
|
+
The Htmlunit version is configured with a environmental variable named `htmlunit_version`. The possible versions are listed at [here](http://sourceforge.net/projects/htmlunit/files/htmlunit/)
|
176
|
+
|
177
|
+
```
|
178
|
+
ENV["htmlunit_version"] = "2.10" # Development Snapshots
|
179
|
+
ENV["htmlunit_version"] = "2.9"
|
180
|
+
ENV["htmlunit_version"] = "2.8"
|
181
|
+
ENV["htmlunit_version"] = "2.7"
|
182
|
+
```
|
159
183
|
|
184
|
+
It defaults to HtmlUnit 2.9. You can manually download or copy your own version to .akephalos/:version and use it with `ENV["htmlunit_version"] = "version"`
|
160
185
|
|
161
186
|
### Using a different browser
|
162
187
|
|
@@ -169,16 +194,16 @@ Capybara.register_driver :akephalos do |app|
|
|
169
194
|
# available options:
|
170
195
|
# :ie6, :ie7, :ie8, :firefox_3_6
|
171
196
|
Capybara::Driver::Akephalos.new(app, :browser => :ie8)
|
172
|
-
end
|
173
|
-
```
|
197
|
+
end
|
198
|
+
```
|
174
199
|
|
175
200
|
|
176
201
|
### Using a Proxy Server
|
177
|
-
|
178
|
-
``` ruby
|
202
|
+
|
203
|
+
``` ruby
|
179
204
|
Capybara.register_driver :akephalos do |app|
|
180
205
|
Capybara::Driver::Akephalos.new(app, :http_proxy => 'myproxy.com', :http_proxy_port => 8080)
|
181
|
-
end
|
206
|
+
end
|
182
207
|
```
|
183
208
|
|
184
209
|
|
@@ -190,40 +215,40 @@ that certain libraries aren't supported by HtmlUnit. If possible, it's
|
|
190
215
|
best to keep the default behaviour, and use Filters (see below) to mock
|
191
216
|
offending libraries. If needed, however, you can configure Akephalos to
|
192
217
|
ignore javascript errors.
|
193
|
-
|
218
|
+
|
194
219
|
``` ruby
|
195
220
|
Capybara.register_driver :akephalos do |app|
|
196
221
|
Capybara::Driver::Akephalos.new(app, :validate_scripts => false)
|
197
|
-
end
|
198
|
-
```
|
199
|
-
|
222
|
+
end
|
223
|
+
```
|
224
|
+
|
200
225
|
|
201
226
|
### Setting the HtmlUnit log level
|
202
227
|
|
203
228
|
By default it uses the 'fatal' level. You can change that like this:
|
204
|
-
|
229
|
+
|
205
230
|
``` ruby
|
206
|
-
Capybara.register_driver :akephalos do |app|
|
207
|
-
# available options
|
231
|
+
Capybara.register_driver :akephalos do |app|
|
232
|
+
# available options
|
208
233
|
# "trace", "debug", "info", "warn", "error", or "fatal"
|
209
234
|
Capybara::Driver::Akephalos.new(app, :htmlunit_log_level => 'fatal')
|
210
|
-
end
|
235
|
+
end
|
211
236
|
```
|
212
|
-
|
237
|
+
|
213
238
|
|
214
239
|
### Running Akephalos with Spork
|
215
|
-
|
240
|
+
|
216
241
|
``` ruby
|
217
242
|
Spork.prefork do
|
218
243
|
...
|
219
|
-
Akephalos::RemoteClient.manager
|
244
|
+
Akephalos::RemoteClient.manager
|
220
245
|
end
|
221
246
|
|
222
|
-
Spork.each_run do
|
247
|
+
Spork.each_run do
|
223
248
|
...
|
224
249
|
Thread.current['DRb'] = { 'server' => DRb::DRbServer.new }
|
225
250
|
end
|
226
|
-
```
|
251
|
+
```
|
227
252
|
|
228
253
|
|
229
254
|
More info at : [sporking-with-akephalos](http://spacevatican.org/2011/7/3/sporking-with-akephalos)
|
@@ -232,28 +257,28 @@ More info at : [sporking-with-akephalos](http://spacevatican.org/2011/7/3/sporki
|
|
232
257
|
|
233
258
|
Akephalos allows you to filter requests originating from the browser and return mock responses. This will let you easily filter requests for external resources when running your tests, such as Facebook's API and Google Analytics.
|
234
259
|
|
235
|
-
Configuring filters in Akephalos should be familiar to anyone who has used FakeWeb or a similar library. The simplest filter requires only an HTTP method (:get, :post, :put, :delete, :any) and a string or regex to match against.
|
236
|
-
|
260
|
+
Configuring filters in Akephalos should be familiar to anyone who has used FakeWeb or a similar library. The simplest filter requires only an HTTP method (:get, :post, :put, :delete, :any) and a string or regex to match against.
|
261
|
+
|
237
262
|
``` ruby
|
238
263
|
Akephalos.filter(:get, "http://www.google.com")
|
239
264
|
Akephalos.filter(:any, %r{^http://(api\.)?twitter\.com/.*$})
|
240
265
|
```
|
241
|
-
|
242
|
-
|
266
|
+
|
267
|
+
|
243
268
|
By default, all filtered requests will return an empty body with a 200 status code. You can change this by passing additional options to your filter call.
|
244
|
-
|
269
|
+
|
245
270
|
``` ruby
|
246
|
-
Akephalos.filter(:get, "http://google.com/missing",
|
271
|
+
Akephalos.filter(:get, "http://google.com/missing",
|
247
272
|
:status => 404, :body => "... <h1>Not Found</h1> ...")
|
248
273
|
|
249
274
|
Akephalos.filter(:post, "http://my-api.com/resource.xml",
|
250
275
|
:status => 201, :headers => {
|
251
276
|
"Content-Type" => "application/xml",
|
252
277
|
"Location" => "http://my-api.com/resources/1.xml" },
|
253
|
-
:body => {:id => 100}.to_xml)
|
254
|
-
```
|
278
|
+
:body => {:id => 100}.to_xml)
|
279
|
+
```
|
280
|
+
|
255
281
|
|
256
|
-
|
257
282
|
And that's really all there is to it! It should be fairly trivial to set up filters for the external resources you need to fake. For reference, however, here's what we ended up using for our external sources.
|
258
283
|
|
259
284
|
#### Example: Google Maps
|
@@ -262,8 +287,8 @@ Google Analytics code is passively applied based on HTML comments, so simply ret
|
|
262
287
|
|
263
288
|
``` ruby
|
264
289
|
Akephalos.filter(:get, "http://www.google-analytics.com/ga.js",
|
265
|
-
:headers => {"Content-Type" => "application/javascript"})
|
266
|
-
```
|
290
|
+
:headers => {"Content-Type" => "application/javascript"})
|
291
|
+
```
|
267
292
|
|
268
293
|
|
269
294
|
Google Maps requires the most extensive amount of API definitions of the three, but these few lines cover everything we've encountered so far.
|
@@ -278,50 +303,51 @@ Akephalos.filter(:get, "http://maps.google.com/maps/api/js?sensor=false",
|
|
278
303
|
Marker: function(){},
|
279
304
|
MapTypeId: {ROADMAP:1}
|
280
305
|
}
|
281
|
-
};")
|
282
|
-
```
|
306
|
+
};")
|
307
|
+
```
|
308
|
+
|
283
309
|
|
284
|
-
|
285
310
|
#### Example: Facebook Connect
|
286
311
|
|
287
312
|
Facebook Connect
|
288
313
|
|
289
|
-
When you enable Facebook Connect on your page, the FeatureLoader is requested, and then additional resources are loaded when you call FB_RequireFeatures. We can therefore return an empty function from our filter to disable all Facebook Connect code.
|
314
|
+
When you enable Facebook Connect on your page, the FeatureLoader is requested, and then additional resources are loaded when you call FB_RequireFeatures. We can therefore return an empty function from our filter to disable all Facebook Connect code.
|
290
315
|
|
291
316
|
``` ruby
|
292
|
-
Akephalos.filter(:get,
|
317
|
+
Akephalos.filter(:get,
|
293
318
|
"http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php",
|
294
319
|
:headers => {"Content-Type" => "application/javascript"},
|
295
|
-
:body => "window.FB_RequireFeatures = function() {};")
|
296
|
-
```
|
320
|
+
:body => "window.FB_RequireFeatures = function() {};")
|
321
|
+
```
|
322
|
+
|
297
323
|
|
298
|
-
|
299
324
|
### Akephalos' Interactive mode
|
300
325
|
|
301
326
|
#### bin/akephalos
|
302
327
|
|
303
328
|
The bundled akephalos binary provides a command line interface to a few useful features.
|
304
329
|
|
330
|
+
|
305
331
|
#### akephalos --interactive
|
306
332
|
|
307
333
|
Running Akephalos in interactive mode gives you an IRB context for interacting with your site just as you would in your tests:
|
308
|
-
|
334
|
+
|
309
335
|
``` ruby
|
310
336
|
$ akephalos --interactive
|
311
337
|
-> Capybara.app_host # => "http://localhost:3000"
|
312
338
|
-> page.visit "/"
|
313
339
|
-> page.fill_in "Search", :with => "akephalos"
|
314
340
|
-> page.click_button "Go"
|
315
|
-
-> page.has_css?("#search_results") # => true
|
341
|
+
-> page.has_css?("#search_results") # => true
|
316
342
|
```
|
317
|
-
|
318
|
-
|
343
|
+
|
344
|
+
|
319
345
|
#### akephalos --use-htmlunit-snapshot
|
320
|
-
|
346
|
+
|
321
347
|
This will instruct Akephalos to use the latest development snapshot of HtmlUnit as found on it's Cruise Control server. HtmlUnit and its dependencies will be unpacked into vendor/htmlunit in the current working directory.
|
322
348
|
|
323
349
|
This is what the output looks like:
|
324
|
-
|
350
|
+
|
325
351
|
``` ruby
|
326
352
|
$ akephalos --use-htmlunit-snapshot
|
327
353
|
|
@@ -329,9 +355,9 @@ Downloading latest snapshot... done
|
|
329
355
|
Extracting dependencies... done
|
330
356
|
========================================
|
331
357
|
The latest HtmlUnit snapshot has been extracted to vendor/htmlunit!
|
332
|
-
Once HtmlUnit has been extracted, Akephalos will automatically detect
|
358
|
+
Once HtmlUnit has been extracted, Akephalos will automatically detect
|
333
359
|
the vendored version and use it instead of the bundled version.
|
334
|
-
```
|
360
|
+
```
|
335
361
|
|
336
362
|
|
337
363
|
#### akephalos --server <socket_file>
|
data/bin/akephalos
CHANGED
@@ -4,8 +4,9 @@
|
|
4
4
|
require "pathname"
|
5
5
|
require "optparse"
|
6
6
|
require 'rubygems'
|
7
|
+
require "akephalos/htmlunit_downloader"
|
7
8
|
|
8
|
-
options = { :interactive => false, :default_jvm_max_memory => '128'
|
9
|
+
options = { :interactive => false, :default_jvm_max_memory => '128'}
|
9
10
|
|
10
11
|
parser = OptionParser.new do |opts|
|
11
12
|
opts.banner = "Usage: akephalos [--interactive, --use-htmlunit-snapshot, --memory [number]] | [--server] <port>"
|
@@ -13,19 +14,20 @@ parser = OptionParser.new do |opts|
|
|
13
14
|
opts.on("-i", "--interactive", "Run in interactive mode") { options[:interactive] = true }
|
14
15
|
opts.on("--use-htmlunit-snapshot", "Use the snapshot of htmlunit") { options[:use_htmlunit_snapshot] = true }
|
15
16
|
opts.on("-m", "--memory [number]", "Max memory for the Java Virtual Machine, defaults to #{options[:default_jvm_max_memory]}
|
16
|
-
or env variable $akephalos_jvm_max_memory") do |memory|
|
17
|
+
or env variable $akephalos_jvm_max_memory") do |memory|
|
17
18
|
options[:akephalos_jvm_max_memory] = memory.to_s
|
18
|
-
end
|
19
|
-
|
19
|
+
end
|
20
|
+
|
20
21
|
if options[:akephalos_jvm_max_memory].nil?
|
21
|
-
if ENV['akephalos_jvm_max_memory'].nil?
|
22
|
+
if ENV['akephalos_jvm_max_memory'].nil?
|
22
23
|
options[:akephalos_jvm_max_memory] = options[:default_jvm_max_memory]
|
23
24
|
else
|
24
25
|
options[:akephalos_jvm_max_memory] = ENV['akephalos_jvm_max_memory']
|
25
26
|
end
|
26
|
-
end
|
27
|
-
|
28
|
-
|
27
|
+
end
|
28
|
+
puts "Using #{options[:akephalos_jvm_max_memory]} MB for the JVM"
|
29
|
+
|
30
|
+
HtmlUnit.download_htmlunit(ENV["htmlunit_version"])
|
29
31
|
|
30
32
|
opts.on_tail("-h", "--help", "Show this message") { puts opts; exit }
|
31
33
|
end
|
@@ -74,10 +76,10 @@ else
|
|
74
76
|
require 'akephalos/server'
|
75
77
|
Akephalos::Server.start!(port)
|
76
78
|
else
|
77
|
-
require 'jruby-jars'
|
79
|
+
require 'jruby-jars'
|
78
80
|
|
79
81
|
jruby = JRubyJars.core_jar_path
|
80
|
-
jruby_stdlib = JRubyJars.stdlib_jar_path
|
82
|
+
jruby_stdlib = JRubyJars.stdlib_jar_path
|
81
83
|
|
82
84
|
java_args = [
|
83
85
|
"-Xmx#{options[:akephalos_jvm_max_memory]}M",
|
@@ -85,7 +87,7 @@ else
|
|
85
87
|
"org.jruby.Main",
|
86
88
|
"-X+O"
|
87
89
|
]
|
88
|
-
ruby_args = [
|
90
|
+
ruby_args = [
|
89
91
|
"-Ku",
|
90
92
|
"-I", ["vendor", lib, src].join(File::PATH_SEPARATOR),
|
91
93
|
"-r", "akephalos/server",
|
@@ -101,6 +103,6 @@ else
|
|
101
103
|
else
|
102
104
|
ENV["RUBYOPT"] = "--1.9"
|
103
105
|
end
|
104
|
-
exec("java", *(java_args + ruby_args))
|
106
|
+
exec("java", *(java_args + ruby_args))
|
105
107
|
end
|
106
108
|
end
|
data/lib/akephalos/client.rb
CHANGED
@@ -3,7 +3,7 @@ require 'akephalos/configuration'
|
|
3
3
|
if RUBY_PLATFORM != "java"
|
4
4
|
require 'akephalos/remote_client'
|
5
5
|
Akephalos::Client = Akephalos::RemoteClient
|
6
|
-
else
|
6
|
+
else
|
7
7
|
require 'akephalos/htmlunit'
|
8
8
|
require 'akephalos/htmlunit/ext/http_method'
|
9
9
|
require 'akephalos/htmlunit/ext/confirm_handler'
|
@@ -12,7 +12,7 @@ else
|
|
12
12
|
require 'akephalos/node'
|
13
13
|
|
14
14
|
require 'akephalos/client/cookies'
|
15
|
-
require 'akephalos/client/filter'
|
15
|
+
require 'akephalos/client/filter'
|
16
16
|
|
17
17
|
module Akephalos
|
18
18
|
|
@@ -150,7 +150,7 @@ else
|
|
150
150
|
# validate scripts, and htmlunit log level.
|
151
151
|
#
|
152
152
|
# @param [Hash] options the options to process
|
153
|
-
def process_options!(options)
|
153
|
+
def process_options!(options)
|
154
154
|
options = DEFAULT_OPTIONS.merge(options)
|
155
155
|
|
156
156
|
@browser_version = BROWSER_VERSIONS.fetch(options.delete(:browser))
|
@@ -158,7 +158,7 @@ else
|
|
158
158
|
@use_insecure_ssl = options.delete(:use_insecure_ssl)
|
159
159
|
@htmlunit_log_level = options.delete(:htmlunit_log_level)
|
160
160
|
@http_proxy = options.delete(:http_proxy)
|
161
|
-
@http_proxy_port = options.delete(:http_proxy_port)
|
161
|
+
@http_proxy_port = options.delete(:http_proxy_port)
|
162
162
|
|
163
163
|
java.lang.System.setProperty("org.apache.commons.logging.simplelog.defaultlog", @htmlunit_log_level)
|
164
164
|
end
|
data/lib/akephalos/htmlunit.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require "pathname"
|
2
2
|
require "java"
|
3
3
|
|
4
|
-
Dir[File.dirname(__FILE__) + "/../.." + "
|
4
|
+
Dir[File.dirname(__FILE__) + "/../.." + "/.akephalos/#{ENV['htmlunit_version']}/*.jar"].each {|file| require file }
|
5
5
|
|
6
6
|
java.lang.System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog")
|
7
7
|
java.lang.System.setProperty("org.apache.commons.logging.simplelog.defaultlog", "fatal")
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module HtmlUnit
|
2
|
+
def self.download_htmlunit(version)
|
3
|
+
if not version_exist?(version)
|
4
|
+
puts "Installing HTMLUnit #{version} at .akephalos/#{version}/"
|
5
|
+
Dir.mkdir(".akephalos") unless File.exists?(".akephalos")
|
6
|
+
Dir.mkdir(".akephalos/#{version}") unless File.exists?(".akephalos/#{version}")
|
7
|
+
download(version)
|
8
|
+
unzip(version)
|
9
|
+
remove_cache(version)
|
10
|
+
else
|
11
|
+
puts "Using HTMLUnit #{version}"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.version_exist?(version)
|
16
|
+
File.exist?(".akephalos/#{version}/htmlunit-#{version}.jar")
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.unzip(version)
|
20
|
+
`tar xzf htmlunit-#{version}.zip`
|
21
|
+
`mv -f htmlunit-2.10-SNAPSHOT htmlunit-2.10 > /dev/null 2>&1`
|
22
|
+
`cp -r htmlunit-#{version}/lib/ .akephalos/#{version}/`
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.download(version)
|
26
|
+
if version == "2.10"
|
27
|
+
%x[curl -L -o htmlunit-2.10.zip http://build.canoo.com/htmlunit/artifacts/htmlunit-2.10-SNAPSHOT-with-dependencies.zip]
|
28
|
+
elsif version[2] < '9'
|
29
|
+
%x[curl -L -O http://sourceforge.net/projects/htmlunit/files/htmlunit/#{version}/htmlunit-#{version}.zip]
|
30
|
+
else
|
31
|
+
%x[curl -L -o htmlunit-#{version}.zip http://sourceforge.net/projects/htmlunit/files/htmlunit/#{version}/htmlunit-#{version}-bin.zip]
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.remove_cache(version)
|
36
|
+
`rm -rf htmlunit-#{version} htmlunit-#{version}.zip`
|
37
|
+
end
|
38
|
+
end
|
data/lib/akephalos/version.rb
CHANGED
data/lib/akephalos.rb
CHANGED
Binary file
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,19 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: akephalos2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Bernerd Schaefer
|
9
|
+
- Gonzalo Rodríguez-Baltanás Díaz
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date: 2011-
|
13
|
+
date: 2011-11-29 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
name: capybara
|
16
|
-
requirement: &
|
17
|
+
requirement: &70217250384880 !ruby/object:Gem::Requirement
|
17
18
|
none: false
|
18
19
|
requirements:
|
19
20
|
- - ! '>='
|
@@ -21,10 +22,10 @@ dependencies:
|
|
21
22
|
version: '0'
|
22
23
|
type: :runtime
|
23
24
|
prerelease: false
|
24
|
-
version_requirements: *
|
25
|
+
version_requirements: *70217250384880
|
25
26
|
- !ruby/object:Gem::Dependency
|
26
27
|
name: rake
|
27
|
-
requirement: &
|
28
|
+
requirement: &70217250384020 !ruby/object:Gem::Requirement
|
28
29
|
none: false
|
29
30
|
requirements:
|
30
31
|
- - ! '>='
|
@@ -32,10 +33,10 @@ dependencies:
|
|
32
33
|
version: '0'
|
33
34
|
type: :runtime
|
34
35
|
prerelease: false
|
35
|
-
version_requirements: *
|
36
|
+
version_requirements: *70217250384020
|
36
37
|
- !ruby/object:Gem::Dependency
|
37
38
|
name: jruby-jars
|
38
|
-
requirement: &
|
39
|
+
requirement: &70217250382940 !ruby/object:Gem::Requirement
|
39
40
|
none: false
|
40
41
|
requirements:
|
41
42
|
- - ! '>='
|
@@ -43,10 +44,10 @@ dependencies:
|
|
43
44
|
version: '0'
|
44
45
|
type: :runtime
|
45
46
|
prerelease: false
|
46
|
-
version_requirements: *
|
47
|
+
version_requirements: *70217250382940
|
47
48
|
- !ruby/object:Gem::Dependency
|
48
49
|
name: sinatra
|
49
|
-
requirement: &
|
50
|
+
requirement: &70217250411940 !ruby/object:Gem::Requirement
|
50
51
|
none: false
|
51
52
|
requirements:
|
52
53
|
- - ! '>='
|
@@ -54,10 +55,10 @@ dependencies:
|
|
54
55
|
version: '0'
|
55
56
|
type: :development
|
56
57
|
prerelease: false
|
57
|
-
version_requirements: *
|
58
|
+
version_requirements: *70217250411940
|
58
59
|
- !ruby/object:Gem::Dependency
|
59
60
|
name: rspec
|
60
|
-
requirement: &
|
61
|
+
requirement: &70217250411440 !ruby/object:Gem::Requirement
|
61
62
|
none: false
|
62
63
|
requirements:
|
63
64
|
- - ! '>='
|
@@ -65,9 +66,11 @@ dependencies:
|
|
65
66
|
version: '0'
|
66
67
|
type: :development
|
67
68
|
prerelease: false
|
68
|
-
version_requirements: *
|
69
|
+
version_requirements: *70217250411440
|
69
70
|
description: Headless Browser for Integration Testing with Capybara
|
70
|
-
email:
|
71
|
+
email:
|
72
|
+
- bj.schaefer@gmail.com
|
73
|
+
- siotopo@gmail.com
|
71
74
|
executables:
|
72
75
|
- akephalos
|
73
76
|
extensions: []
|
@@ -83,6 +86,7 @@ files:
|
|
83
86
|
- lib/akephalos/htmlunit/ext/confirm_handler.rb
|
84
87
|
- lib/akephalos/htmlunit/ext/http_method.rb
|
85
88
|
- lib/akephalos/htmlunit.rb
|
89
|
+
- lib/akephalos/htmlunit_downloader.rb
|
86
90
|
- lib/akephalos/node.rb
|
87
91
|
- lib/akephalos/page.rb
|
88
92
|
- lib/akephalos/remote_client.rb
|
@@ -93,10 +97,13 @@ files:
|
|
93
97
|
- vendor/html-unit/commons-codec-1.4.jar
|
94
98
|
- vendor/html-unit/commons-collections-3.2.1.jar
|
95
99
|
- vendor/html-unit/commons-io-2.0.1.jar
|
100
|
+
- vendor/html-unit/commons-lang-2.6.jar
|
96
101
|
- vendor/html-unit/commons-lang3-3.0.1.jar
|
97
102
|
- vendor/html-unit/commons-logging-1.1.1.jar
|
103
|
+
- vendor/html-unit/cssparser-0.9.5.jar
|
98
104
|
- vendor/html-unit/cssparser-0.9.6-20110829.205617-3.jar
|
99
105
|
- vendor/html-unit/htmlunit-2.10-SNAPSHOT.jar
|
106
|
+
- vendor/html-unit/htmlunit-2.9.jar
|
100
107
|
- vendor/html-unit/htmlunit-core-js-2.9.jar
|
101
108
|
- vendor/html-unit/httpclient-4.1.2.jar
|
102
109
|
- vendor/html-unit/httpcore-4.1.2.jar
|
@@ -130,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
137
|
- !ruby/object:Gem::Version
|
131
138
|
version: '0'
|
132
139
|
requirements: []
|
133
|
-
rubyforge_project:
|
140
|
+
rubyforge_project:
|
134
141
|
rubygems_version: 1.8.10
|
135
142
|
signing_key:
|
136
143
|
specification_version: 3
|