imseng-capybara-webkit 0.12.1
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/.gitignore +21 -0
- data/.rspec +2 -0
- data/Appraisals +7 -0
- data/CONTRIBUTING.md +47 -0
- data/ChangeLog +70 -0
- data/Gemfile +3 -0
- data/LICENSE +19 -0
- data/NEWS.md +36 -0
- data/README.md +114 -0
- data/Rakefile +65 -0
- data/bin/Info.plist +22 -0
- data/capybara-webkit.gemspec +28 -0
- data/extconf.rb +2 -0
- data/gemfiles/1.0.gemfile +7 -0
- data/gemfiles/1.0.gemfile.lock +70 -0
- data/gemfiles/1.1.gemfile +7 -0
- data/gemfiles/1.1.gemfile.lock +70 -0
- data/lib/capybara/driver/webkit/browser.rb +164 -0
- data/lib/capybara/driver/webkit/connection.rb +120 -0
- data/lib/capybara/driver/webkit/cookie_jar.rb +55 -0
- data/lib/capybara/driver/webkit/node.rb +118 -0
- data/lib/capybara/driver/webkit/socket_debugger.rb +43 -0
- data/lib/capybara/driver/webkit/version.rb +7 -0
- data/lib/capybara/driver/webkit.rb +136 -0
- data/lib/capybara/webkit/matchers.rb +37 -0
- data/lib/capybara/webkit.rb +13 -0
- data/lib/capybara-webkit.rb +1 -0
- data/lib/capybara_webkit_builder.rb +68 -0
- data/spec/browser_spec.rb +173 -0
- data/spec/capybara_webkit_builder_spec.rb +37 -0
- data/spec/connection_spec.rb +54 -0
- data/spec/cookie_jar_spec.rb +48 -0
- data/spec/driver_rendering_spec.rb +80 -0
- data/spec/driver_resize_window_spec.rb +59 -0
- data/spec/driver_spec.rb +1552 -0
- data/spec/integration/driver_spec.rb +20 -0
- data/spec/integration/session_spec.rb +137 -0
- data/spec/self_signed_ssl_cert.rb +42 -0
- data/spec/spec_helper.rb +46 -0
- data/src/Body.h +12 -0
- data/src/ClearCookies.cpp +15 -0
- data/src/ClearCookies.h +11 -0
- data/src/Command.cpp +19 -0
- data/src/Command.h +31 -0
- data/src/CommandFactory.cpp +37 -0
- data/src/CommandFactory.h +16 -0
- data/src/CommandParser.cpp +76 -0
- data/src/CommandParser.h +33 -0
- data/src/Connection.cpp +71 -0
- data/src/Connection.h +37 -0
- data/src/ConsoleMessages.cpp +10 -0
- data/src/ConsoleMessages.h +12 -0
- data/src/CurrentUrl.cpp +68 -0
- data/src/CurrentUrl.h +16 -0
- data/src/Evaluate.cpp +84 -0
- data/src/Evaluate.h +22 -0
- data/src/Execute.cpp +16 -0
- data/src/Execute.h +12 -0
- data/src/Find.cpp +19 -0
- data/src/Find.h +13 -0
- data/src/FrameFocus.cpp +66 -0
- data/src/FrameFocus.h +28 -0
- data/src/GetCookies.cpp +20 -0
- data/src/GetCookies.h +14 -0
- data/src/Header.cpp +18 -0
- data/src/Header.h +11 -0
- data/src/Headers.cpp +10 -0
- data/src/Headers.h +12 -0
- data/src/IgnoreSslErrors.cpp +12 -0
- data/src/IgnoreSslErrors.h +12 -0
- data/src/JavascriptInvocation.cpp +14 -0
- data/src/JavascriptInvocation.h +19 -0
- data/src/NetworkAccessManager.cpp +29 -0
- data/src/NetworkAccessManager.h +19 -0
- data/src/NetworkCookieJar.cpp +101 -0
- data/src/NetworkCookieJar.h +15 -0
- data/src/Node.cpp +14 -0
- data/src/Node.h +13 -0
- data/src/NullCommand.cpp +10 -0
- data/src/NullCommand.h +11 -0
- data/src/PageLoadingCommand.cpp +46 -0
- data/src/PageLoadingCommand.h +40 -0
- data/src/Render.cpp +18 -0
- data/src/Render.h +12 -0
- data/src/RequestedUrl.cpp +12 -0
- data/src/RequestedUrl.h +12 -0
- data/src/Reset.cpp +29 -0
- data/src/Reset.h +15 -0
- data/src/ResizeWindow.cpp +16 -0
- data/src/ResizeWindow.h +12 -0
- data/src/Response.cpp +24 -0
- data/src/Response.h +15 -0
- data/src/Server.cpp +24 -0
- data/src/Server.h +21 -0
- data/src/SetCookie.cpp +16 -0
- data/src/SetCookie.h +11 -0
- data/src/SetProxy.cpp +22 -0
- data/src/SetProxy.h +11 -0
- data/src/Source.cpp +18 -0
- data/src/Source.h +19 -0
- data/src/Status.cpp +12 -0
- data/src/Status.h +12 -0
- data/src/UnsupportedContentHandler.cpp +32 -0
- data/src/UnsupportedContentHandler.h +18 -0
- data/src/Url.cpp +12 -0
- data/src/Url.h +12 -0
- data/src/Visit.cpp +12 -0
- data/src/Visit.h +12 -0
- data/src/WebPage.cpp +239 -0
- data/src/WebPage.h +58 -0
- data/src/body.cpp +10 -0
- data/src/capybara.js +315 -0
- data/src/find_command.h +29 -0
- data/src/main.cpp +33 -0
- data/src/webkit_server.pro +85 -0
- data/src/webkit_server.qrc +5 -0
- data/templates/Command.cpp +10 -0
- data/templates/Command.h +12 -0
- data/webkit_server.pro +4 -0
- metadata +298 -0
data/.gitignore
ADDED
data/.rspec
ADDED
data/Appraisals
ADDED
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
We love pull requests. Here's a quick guide:
|
2
|
+
|
3
|
+
Dependencies
|
4
|
+
|
5
|
+
Some of the tests depend on the `identify` command that comes with Imagemagick.
|
6
|
+
Imagemagick can be installed via [homebrew](http://mxcl.github.com/homebrew/).
|
7
|
+
|
8
|
+
brew install imagemagick
|
9
|
+
|
10
|
+
Contributing
|
11
|
+
|
12
|
+
1. Fork the repo.
|
13
|
+
|
14
|
+
2. Run the tests. We only take pull requests with passing tests, and it's great
|
15
|
+
to know that you have a clean slate: `bundle && bundle exec rake`
|
16
|
+
|
17
|
+
3. Add a test for your change. Only refactoring and documentation changes
|
18
|
+
require no new tests. If you are adding functionality or fixing a bug, we need
|
19
|
+
a test!
|
20
|
+
|
21
|
+
4. Make the test pass.
|
22
|
+
|
23
|
+
5. Push to your fork and submit a pull request.
|
24
|
+
|
25
|
+
|
26
|
+
At this point you're waiting on us. We like to at least comment on, if not
|
27
|
+
accept, pull requests within three business days (and, typically, one business
|
28
|
+
day). We may suggest some changes or improvements or alternatives.
|
29
|
+
|
30
|
+
Some things that will increase the chance that your pull request is accepted,
|
31
|
+
taken straight from the Ruby on Rails guide:
|
32
|
+
|
33
|
+
* Use Rails idioms and helpers
|
34
|
+
* Include tests that fail without your code, and pass with it
|
35
|
+
* Update the documentation, the surrounding one, examples elsewhere, guides,
|
36
|
+
whatever is affected by your contribution
|
37
|
+
|
38
|
+
Syntax:
|
39
|
+
|
40
|
+
* Two spaces, no tabs.
|
41
|
+
* No trailing whitespace. Blank lines should not have any space.
|
42
|
+
* Prefer &&/|| over and/or.
|
43
|
+
* MyClass.my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
|
44
|
+
* a = b and not a=b.
|
45
|
+
* Follow the conventions you see used in the source already.
|
46
|
+
|
47
|
+
And in case we didn't emphasize it enough: we love tests!
|
data/ChangeLog
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
2012-03-09 Joe Ferris <jferris@thoughtbot.com>
|
2
|
+
* node.rb, driver_spec.rb: Allow interaction with invisible elements
|
3
|
+
|
4
|
+
2012-03-02 Joe Ferris <jferris@thoughtbot.com>
|
5
|
+
* browser.rb: Use Timeout from stdlib since Capybara.timeout is being removed
|
6
|
+
|
7
|
+
2012-03-02 Matthew Mongeau <halogenandtoast@gmail.com>
|
8
|
+
* capybara_webkit_builder.rb:
|
9
|
+
set LANG to en_US.UTF-8 to prevent string encoding issues during install
|
10
|
+
|
11
|
+
2012-03-02 Marc Schwieterman
|
12
|
+
* Rakefile: pro, find_command, and CommandFactory are more structured
|
13
|
+
|
14
|
+
2012-02-27 Joe Ferris <jferris@thoughtbot.com>
|
15
|
+
* README.md: Fixed broken wiki link
|
16
|
+
|
17
|
+
2012-02-24 Joe Ferris <jferris@thoughtbot.com>
|
18
|
+
* README.md: Update instructions for platform specific installation issues
|
19
|
+
|
20
|
+
2012-02-17 Matthew Mongeau <halogenandtoast@gmail.com>
|
21
|
+
* driver_spec.rb, capybara.js: Send proper keycode during keypress event
|
22
|
+
|
23
|
+
2012-02-17 Matthew Mongeau <halogenandtoast@gmail.com>
|
24
|
+
* ChangeLog, version.rb:
|
25
|
+
Bump to 0.10.0
|
26
|
+
|
27
|
+
2012-02-17 Marc Schwieterman
|
28
|
+
* driver_spec.rb, Reset.cpp, Reset.h: Reset history when resetting session.
|
29
|
+
* driver_spec.rb, webkit.rb, browser.rb, CommandFactory.cpp, CurrentUrl.cpp,
|
30
|
+
CurrentUrl.h, find_command.h, webkit_server.pro:
|
31
|
+
current_url now conforms more closely to the behavior of Selenium.
|
32
|
+
|
33
|
+
2012-02-17 Igor Zubkov <igor.zubkov@gmail.com>
|
34
|
+
* spec_helper.rb: Fix typo.
|
35
|
+
|
36
|
+
2012-02-17 Matthew Mongeau <halogenandtoast@gmail.com>
|
37
|
+
* capybara_webkit_builder.rb, capybara_webkit_builder_spec.rb,
|
38
|
+
spec_helper.rb:
|
39
|
+
Allow for overriding MAKE, QMAKE, and SPEC options via the environment.
|
40
|
+
|
41
|
+
2012-02-12 Jason Petersen <jasonmp85@gmail.com>
|
42
|
+
* driver_spec.rb, node.rb, capybara.js:
|
43
|
+
Selected attribute is no longer removed when selecting/deselecting. Only the
|
44
|
+
property is changed.
|
45
|
+
|
46
|
+
2012-02-09 Gabe Berke-Williams <gabe@thoughtbot.com>
|
47
|
+
* capybara-webkit.gemspec: Note capybara-webkit's usage of Sinatra.
|
48
|
+
|
49
|
+
2012-02-03 Matthew Mongeau <halogenandtoast@gmail.com>
|
50
|
+
* version.rb:
|
51
|
+
Bump to 0.9.0
|
52
|
+
|
53
|
+
2012-02-01 Joe Ferris <jferris@thoughtbot.com>
|
54
|
+
* driver_spec.rb, Connection.cpp, Connection.h:
|
55
|
+
Try to detect when a command starts a page load and wait for it to finish.
|
56
|
+
|
57
|
+
2012-01-27 Matthew Mongeau <halogenandtoast@gmail.com>
|
58
|
+
* driver_spec.rb, capybara.js: Trigger mousedown and mouseup events.
|
59
|
+
* driver_spec.rb, capybara.js: Simulate browser events more closely.
|
60
|
+
|
61
|
+
2012-01-19 Marco Antonio <marcofognog@gmail.com>
|
62
|
+
* node.rb, driver_spec.rb:
|
63
|
+
Raise ElementNotDisplayedError also for #drag_to and #select_option when they are invisible.
|
64
|
+
|
65
|
+
2012-01-18 Marco Antonio <marcofognog@gmail.com>
|
66
|
+
* node.rb, driver_spec.rb:
|
67
|
+
Raise error when an invisible element receives #click so it resembles a browser more closely.
|
68
|
+
|
69
|
+
2012-01-15 Marc Schwieterman
|
70
|
+
* CONTRIBUTING.md: add imagemagick dependency to contributing guide.
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2011 thoughtbot, inc.
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/NEWS.md
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
New for 0.12.0:
|
2
|
+
* Better windows support
|
3
|
+
* Support for localStorage
|
4
|
+
* Added support for oninput event
|
5
|
+
* Added resize_window method
|
6
|
+
* Server binds on LocalHost to prevent having to add firewall exceptions
|
7
|
+
* Reuse NetworkAccessManager to prevent "too many open files" errors
|
8
|
+
* Response messages are stored as QByteArray to prevent truncating content
|
9
|
+
* Browser no longer tries to read empty responses (Fixes jruby issues).
|
10
|
+
* Server will timeout if it can not start
|
11
|
+
|
12
|
+
New for 0.11.0:
|
13
|
+
|
14
|
+
* Allow interaction with invisible elements
|
15
|
+
* Use Timeout from stdlib since Capybara.timeout is being removed
|
16
|
+
|
17
|
+
New for 0.10.1:
|
18
|
+
|
19
|
+
* LANG environment variable is set to en_US.UTF-8 in order to avoid string encoding issues from qmake.
|
20
|
+
* pro, find_command, and CommandFactory are more structured.
|
21
|
+
* Changed wiki link and directing platform specific issues to the google group.
|
22
|
+
* Pass proper keycode value for keypress events.
|
23
|
+
|
24
|
+
New for 0.10.0:
|
25
|
+
|
26
|
+
* current_url now more closely matches the behavior of Selenium
|
27
|
+
* custom MAKE, QMAKE, and SPEC options can be set from the environment
|
28
|
+
* BUG: Selected attribute is no longer removed when selecting/deselecting. Only the property is changed.
|
29
|
+
|
30
|
+
New for 0.9.0:
|
31
|
+
|
32
|
+
* Raise an error when an invisible element receives #click.
|
33
|
+
* Raise ElementNotDisplayedError for #drag_to and #select_option when element is invisible.
|
34
|
+
* Trigger mousedown and mouseup events.
|
35
|
+
* Model mouse events more closely to the browser.
|
36
|
+
* Try to detech when a command starts a page load and wait for it to finish
|
data/README.md
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
capybara-webkit
|
2
|
+
===============
|
3
|
+
|
4
|
+
A [capybara](https://github.com/jnicklas/capybara) driver that uses [WebKit](http://webkit.org) via [QtWebKit](http://doc.qt.nokia.com/4.7/qtwebkit.html).
|
5
|
+
|
6
|
+
Qt Dependency and Installation Issues
|
7
|
+
-------------
|
8
|
+
|
9
|
+
capybara-webkit depends on a WebKit implementation from Qt, a cross-platform
|
10
|
+
development toolkit. You'll need to download the Qt libraries to build and
|
11
|
+
install the gem. You can find instructions for downloading and installing QT on
|
12
|
+
the [capybara-webkit wiki](https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit)
|
13
|
+
|
14
|
+
Windows Support
|
15
|
+
---------------
|
16
|
+
|
17
|
+
Currently 32bit Windows will compile Capybara-webkit. Support for Windows is provided by the open source community and Windows related issues should be posted to the [mailing list](http://groups.google.com/group/capybara-webkit)
|
18
|
+
|
19
|
+
Reporting Issues
|
20
|
+
----------------
|
21
|
+
|
22
|
+
Without access to your application code we can't easily debug most crashes or
|
23
|
+
generic failures, so we've included a debug version of the driver that prints a
|
24
|
+
log of what happened during each test. Before filing a crash bug, please see
|
25
|
+
[Reporting Crashes](https://github.com/thoughtbot/capybara-webkit/wiki/Reporting-Crashes).
|
26
|
+
You're much more likely to get a fix if you follow those instructions.
|
27
|
+
|
28
|
+
If you are having compiling issues please check out the
|
29
|
+
[capybara-webkit wiki](https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit).
|
30
|
+
If you don't have any luck there, please post to the
|
31
|
+
[mailing list](http://groups.google.com/group/capybara-webkit). Please don't
|
32
|
+
open a Github issue for a system-specific compiler issue.
|
33
|
+
|
34
|
+
CI
|
35
|
+
--
|
36
|
+
|
37
|
+
If you're like us, you'll be using capybara-webkit on CI.
|
38
|
+
|
39
|
+
On Linux platforms, capybara-webkit requires an X server to run, although it doesn't create any visible windows. Xvfb works fine for this. You can setup Xvfb yourself and set a DISPLAY variable, or try out the [headless gem](https://github.com/leonid-shevtsov/headless).
|
40
|
+
|
41
|
+
Usage
|
42
|
+
-----
|
43
|
+
|
44
|
+
Add the capybara-webkit gem to your Gemfile:
|
45
|
+
|
46
|
+
gem "capybara-webkit"
|
47
|
+
|
48
|
+
Set your Capybara Javascript driver to webkit:
|
49
|
+
|
50
|
+
Capybara.javascript_driver = :webkit
|
51
|
+
|
52
|
+
In cucumber, tag scenarios with @javascript to run them using a headless WebKit browser.
|
53
|
+
|
54
|
+
In RSpec, use the :js => true flag.
|
55
|
+
|
56
|
+
Take note of the transactional fixtures section of the [capybara README](https://github.com/jnicklas/capybara/blob/master/README.md).
|
57
|
+
|
58
|
+
If you're using capybara-webkit with Sinatra, don't forget to set
|
59
|
+
|
60
|
+
Capybara.app = MySinatraApp.new
|
61
|
+
|
62
|
+
Non-Standard Driver Methods
|
63
|
+
---------------------------
|
64
|
+
|
65
|
+
capybara-webkit supports a few methods that are not part of the standard capybara API. You can access these by calling `driver` on the capybara session. When using the DSL, that will look like `page.driver.method_name`.
|
66
|
+
|
67
|
+
**console_messages**: returns an array of messages printed using console.log
|
68
|
+
|
69
|
+
# In Javascript:
|
70
|
+
console.log("hello")
|
71
|
+
# In Ruby:
|
72
|
+
page.driver.console_messages
|
73
|
+
=> {:source=>"http://example.com", :line_number=>1, :message=>"hello"}
|
74
|
+
|
75
|
+
**error_messages**: returns an array of Javascript errors that occurred
|
76
|
+
|
77
|
+
page.driver.error_messages
|
78
|
+
=> {:source=>"http://example.com", :line_number=>1, :message=>"SyntaxError: Parse error"}
|
79
|
+
|
80
|
+
**resize_window**: change the viewport size to the given width and height
|
81
|
+
|
82
|
+
page.driver.resize_window(500, 300)
|
83
|
+
page.driver.evaluate_script("window.innerWidth")
|
84
|
+
=> 500
|
85
|
+
|
86
|
+
**render**: render a screenshot of the current view (requires [mini_magick](https://github.com/probablycorey/mini_magick) and [ImageMagick](http://www.imagemagick.org))
|
87
|
+
|
88
|
+
page.driver.render "tmp/screenshot.png"
|
89
|
+
|
90
|
+
**cookies**: allows read-only access of cookies for the current session
|
91
|
+
|
92
|
+
page.driver.cookies["alpha"]
|
93
|
+
=> "abc"
|
94
|
+
|
95
|
+
Contributing
|
96
|
+
------------
|
97
|
+
|
98
|
+
See the CONTRIBUTING document.
|
99
|
+
|
100
|
+
About
|
101
|
+
-----
|
102
|
+
|
103
|
+
The capybara WebKit driver is maintained by Joe Ferris and Matt Mongeau. It was written by [thoughtbot, inc](http://thoughtbot.com/community) with the help of numerous [contributions from the open source community](https://github.com/thoughtbot/capybara-webkit/contributors).
|
104
|
+
|
105
|
+
Code for rendering the current webpage to a PNG is borrowed from Phantom.js' implementation.
|
106
|
+
|
107
|
+

|
108
|
+
|
109
|
+
The names and logos for thoughtbot are trademarks of thoughtbot, inc.
|
110
|
+
|
111
|
+
License
|
112
|
+
-------
|
113
|
+
|
114
|
+
capybara-webkit is Copyright (c) 2011 thoughtbot, inc. It is free software, and may be redistributed under the terms specified in the LICENSE file.
|
data/Rakefile
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
require 'capybara_webkit_builder'
|
4
|
+
require 'appraisal'
|
5
|
+
|
6
|
+
Bundler::GemHelper.install_tasks
|
7
|
+
|
8
|
+
desc "Generate a Makefile using qmake"
|
9
|
+
file 'Makefile' do
|
10
|
+
CapybaraWebkitBuilder.makefile or exit(1)
|
11
|
+
end
|
12
|
+
|
13
|
+
desc "Regenerate dependencies using qmake"
|
14
|
+
task :qmake => 'Makefile' do
|
15
|
+
CapybaraWebkitBuilder.qmake or exit(1)
|
16
|
+
end
|
17
|
+
|
18
|
+
desc "Build the webkit server"
|
19
|
+
task :build => :qmake do
|
20
|
+
CapybaraWebkitBuilder.build or exit(1)
|
21
|
+
end
|
22
|
+
|
23
|
+
file 'bin/webkit_server' => :build
|
24
|
+
|
25
|
+
RSpec::Core::RakeTask.new do |t|
|
26
|
+
t.pattern = "spec/**/*_spec.rb"
|
27
|
+
t.rspec_opts = "--format progress"
|
28
|
+
end
|
29
|
+
|
30
|
+
desc "Default: build and run all specs"
|
31
|
+
task :default => [:build, :spec]
|
32
|
+
|
33
|
+
desc "Generate a new command called NAME"
|
34
|
+
task :generate_command do
|
35
|
+
name = ENV['NAME'] or raise "Provide a name with NAME="
|
36
|
+
|
37
|
+
header = "src/#{name}.h"
|
38
|
+
source = "src/#{name}.cpp"
|
39
|
+
|
40
|
+
%w(h cpp).each do |extension|
|
41
|
+
File.open("templates/Command.#{extension}", "r") do |source_file|
|
42
|
+
contents = source_file.read
|
43
|
+
contents.gsub!("NAME", name)
|
44
|
+
File.open("src/#{name}.#{extension}", "w") do |target_file|
|
45
|
+
target_file.write(contents)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
Dir.glob("src/*.pro").each do |project_file_name|
|
51
|
+
project = IO.read(project_file_name)
|
52
|
+
project.gsub!(/^(HEADERS = .*)/, "\\1\n #{name}.h \\")
|
53
|
+
project.gsub!(/^(SOURCES = .*)/, "\\1\n #{name}.cpp \\")
|
54
|
+
File.open(project_file_name, "w") { |file| file.write(project) }
|
55
|
+
end
|
56
|
+
|
57
|
+
File.open("src/find_command.h", "a") do |file|
|
58
|
+
file.write("CHECK_COMMAND(#{name})\n")
|
59
|
+
end
|
60
|
+
|
61
|
+
command_factory_file_name = "src/CommandFactory.cpp"
|
62
|
+
command_factory = IO.read(command_factory_file_name)
|
63
|
+
command_factory.sub!(/^$/, "#include \"#{name}.h\"\n")
|
64
|
+
File.open(command_factory_file_name, "w") { |file| file.write(command_factory) }
|
65
|
+
end
|
data/bin/Info.plist
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
|
3
|
+
<plist version="0.9">
|
4
|
+
<dict>
|
5
|
+
<key>CFBundleIconFile</key>
|
6
|
+
<string></string>
|
7
|
+
<key>CFBundlePackageType</key>
|
8
|
+
<string>APPL</string>
|
9
|
+
<key>CFBundleGetInfoString</key>
|
10
|
+
<string>Created by Qt/QMake</string>
|
11
|
+
<key>CFBundleSignature</key>
|
12
|
+
<string>????</string>
|
13
|
+
<key>CFBundleExecutable</key>
|
14
|
+
<string>webkit_server</string>
|
15
|
+
<key>CFBundleIdentifier</key>
|
16
|
+
<string>com.yourcompany.webkit_server</string>
|
17
|
+
<key>NOTE</key>
|
18
|
+
<string>This file was generated by Qt/QMake.</string>
|
19
|
+
<key>LSUIElement</key>
|
20
|
+
<string>1</string>
|
21
|
+
</dict>
|
22
|
+
</plist>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
require "capybara/driver/webkit/version"
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "imseng-capybara-webkit"
|
6
|
+
s.version = Capybara::Driver::Webkit::VERSION.dup
|
7
|
+
s.authors = ["imseng", "Thoughtbot", "Joe Ferris", "Matt Mongeau", "Mike Burns", "Jason Morrison"]
|
8
|
+
s.email = "darrin.wortlehock@db.com"
|
9
|
+
s.homepage = "http://github.com/imseng/capybara-webkit"
|
10
|
+
s.summary = "Headless Webkit driver for Capybara"
|
11
|
+
|
12
|
+
s.files = `git ls-files`.split("\n")
|
13
|
+
s.test_files = `git ls-files -- {spec,features}/*`.split("\n")
|
14
|
+
s.require_path = "lib"
|
15
|
+
|
16
|
+
s.extensions = "extconf.rb"
|
17
|
+
|
18
|
+
s.add_runtime_dependency("capybara", [">= 1.0.0", "< 1.2"])
|
19
|
+
s.add_runtime_dependency("json")
|
20
|
+
|
21
|
+
s.add_development_dependency("rspec", "~> 2.6.0")
|
22
|
+
# Sinatra is used by Capybara's TestApp
|
23
|
+
s.add_development_dependency("sinatra")
|
24
|
+
s.add_development_dependency("mini_magick")
|
25
|
+
s.add_development_dependency("rake")
|
26
|
+
s.add_development_dependency("appraisal", "~> 0.4.0")
|
27
|
+
end
|
28
|
+
|
data/extconf.rb
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
PATH
|
2
|
+
remote: /Users/jferris/Source/capybara-webkit
|
3
|
+
specs:
|
4
|
+
capybara-webkit (0.8.0)
|
5
|
+
capybara (>= 1.0.0, < 1.2)
|
6
|
+
json
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: http://rubygems.org/
|
10
|
+
specs:
|
11
|
+
appraisal (0.4.0)
|
12
|
+
bundler
|
13
|
+
rake
|
14
|
+
capybara (1.0.1)
|
15
|
+
mime-types (>= 1.16)
|
16
|
+
nokogiri (>= 1.3.3)
|
17
|
+
rack (>= 1.0.0)
|
18
|
+
rack-test (>= 0.5.4)
|
19
|
+
selenium-webdriver (~> 2.0)
|
20
|
+
xpath (~> 0.1.4)
|
21
|
+
childprocess (0.2.2)
|
22
|
+
ffi (~> 1.0.6)
|
23
|
+
diff-lcs (1.1.3)
|
24
|
+
ffi (1.0.10)
|
25
|
+
json (1.6.3)
|
26
|
+
json_pure (1.6.1)
|
27
|
+
mime-types (1.17.2)
|
28
|
+
mini_magick (3.3)
|
29
|
+
subexec (~> 0.1.0)
|
30
|
+
nokogiri (1.5.0)
|
31
|
+
rack (1.3.5)
|
32
|
+
rack-protection (1.1.4)
|
33
|
+
rack
|
34
|
+
rack-test (0.6.1)
|
35
|
+
rack (>= 1.0)
|
36
|
+
rake (0.9.2.2)
|
37
|
+
rspec (2.6.0)
|
38
|
+
rspec-core (~> 2.6.0)
|
39
|
+
rspec-expectations (~> 2.6.0)
|
40
|
+
rspec-mocks (~> 2.6.0)
|
41
|
+
rspec-core (2.6.4)
|
42
|
+
rspec-expectations (2.6.0)
|
43
|
+
diff-lcs (~> 1.1.2)
|
44
|
+
rspec-mocks (2.6.0)
|
45
|
+
rubyzip (0.9.4)
|
46
|
+
selenium-webdriver (2.12.1)
|
47
|
+
childprocess (>= 0.2.1)
|
48
|
+
ffi (~> 1.0.9)
|
49
|
+
json_pure
|
50
|
+
rubyzip
|
51
|
+
sinatra (1.3.1)
|
52
|
+
rack (~> 1.3, >= 1.3.4)
|
53
|
+
rack-protection (~> 1.1, >= 1.1.2)
|
54
|
+
tilt (~> 1.3, >= 1.3.3)
|
55
|
+
subexec (0.1.0)
|
56
|
+
tilt (1.3.3)
|
57
|
+
xpath (0.1.4)
|
58
|
+
nokogiri (~> 1.3)
|
59
|
+
|
60
|
+
PLATFORMS
|
61
|
+
ruby
|
62
|
+
|
63
|
+
DEPENDENCIES
|
64
|
+
appraisal (~> 0.4.0)
|
65
|
+
capybara (~> 1.0.0)
|
66
|
+
capybara-webkit!
|
67
|
+
mini_magick
|
68
|
+
rake
|
69
|
+
rspec (~> 2.6.0)
|
70
|
+
sinatra
|
@@ -0,0 +1,70 @@
|
|
1
|
+
PATH
|
2
|
+
remote: /Users/jferris/Source/capybara-webkit
|
3
|
+
specs:
|
4
|
+
capybara-webkit (0.8.0)
|
5
|
+
capybara (>= 1.0.0, < 1.2)
|
6
|
+
json
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: http://rubygems.org/
|
10
|
+
specs:
|
11
|
+
appraisal (0.4.0)
|
12
|
+
bundler
|
13
|
+
rake
|
14
|
+
capybara (1.1.1)
|
15
|
+
mime-types (>= 1.16)
|
16
|
+
nokogiri (>= 1.3.3)
|
17
|
+
rack (>= 1.0.0)
|
18
|
+
rack-test (>= 0.5.4)
|
19
|
+
selenium-webdriver (~> 2.0)
|
20
|
+
xpath (~> 0.1.4)
|
21
|
+
childprocess (0.2.2)
|
22
|
+
ffi (~> 1.0.6)
|
23
|
+
diff-lcs (1.1.3)
|
24
|
+
ffi (1.0.10)
|
25
|
+
json (1.6.3)
|
26
|
+
json_pure (1.6.1)
|
27
|
+
mime-types (1.17.2)
|
28
|
+
mini_magick (3.3)
|
29
|
+
subexec (~> 0.1.0)
|
30
|
+
nokogiri (1.5.0)
|
31
|
+
rack (1.3.5)
|
32
|
+
rack-protection (1.1.4)
|
33
|
+
rack
|
34
|
+
rack-test (0.6.1)
|
35
|
+
rack (>= 1.0)
|
36
|
+
rake (0.9.2.2)
|
37
|
+
rspec (2.6.0)
|
38
|
+
rspec-core (~> 2.6.0)
|
39
|
+
rspec-expectations (~> 2.6.0)
|
40
|
+
rspec-mocks (~> 2.6.0)
|
41
|
+
rspec-core (2.6.4)
|
42
|
+
rspec-expectations (2.6.0)
|
43
|
+
diff-lcs (~> 1.1.2)
|
44
|
+
rspec-mocks (2.6.0)
|
45
|
+
rubyzip (0.9.4)
|
46
|
+
selenium-webdriver (2.12.1)
|
47
|
+
childprocess (>= 0.2.1)
|
48
|
+
ffi (~> 1.0.9)
|
49
|
+
json_pure
|
50
|
+
rubyzip
|
51
|
+
sinatra (1.3.1)
|
52
|
+
rack (~> 1.3, >= 1.3.4)
|
53
|
+
rack-protection (~> 1.1, >= 1.1.2)
|
54
|
+
tilt (~> 1.3, >= 1.3.3)
|
55
|
+
subexec (0.1.0)
|
56
|
+
tilt (1.3.3)
|
57
|
+
xpath (0.1.4)
|
58
|
+
nokogiri (~> 1.3)
|
59
|
+
|
60
|
+
PLATFORMS
|
61
|
+
ruby
|
62
|
+
|
63
|
+
DEPENDENCIES
|
64
|
+
appraisal (~> 0.4.0)
|
65
|
+
capybara (~> 1.1.0)
|
66
|
+
capybara-webkit!
|
67
|
+
mini_magick
|
68
|
+
rake
|
69
|
+
rspec (~> 2.6.0)
|
70
|
+
sinatra
|