rsutphin-shenandoah 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. data/.braids +8 -0
  2. data/.document +5 -0
  3. data/.gitignore +6 -0
  4. data/ChangeLog.markdown +13 -0
  5. data/LICENSE +20 -0
  6. data/LICENSE-Blue-Ridge +20 -0
  7. data/LICENSE-Screw.Unit +22 -0
  8. data/LICENSE-Smoke +22 -0
  9. data/README.markdown +280 -0
  10. data/Rakefile +71 -0
  11. data/VERSION.yml +4 -0
  12. data/lib/shenandoah/buildr.rb +9 -0
  13. data/lib/shenandoah/buildr/locator.rb +17 -0
  14. data/lib/shenandoah/buildr/shenandoah_tasks.rb +18 -0
  15. data/lib/shenandoah/buildr/test_framework.rb +28 -0
  16. data/lib/shenandoah/css/screw.css +90 -0
  17. data/lib/shenandoah/javascript/browser/runner.js +34 -0
  18. data/lib/shenandoah/javascript/common/jquery-1.3.2.js +4376 -0
  19. data/lib/shenandoah/javascript/common/jquery.fn.js +29 -0
  20. data/lib/shenandoah/javascript/common/jquery.print.js +109 -0
  21. data/lib/shenandoah/javascript/common/screw.behaviors.js +129 -0
  22. data/lib/shenandoah/javascript/common/screw.builder.js +104 -0
  23. data/lib/shenandoah/javascript/common/screw.events.js +45 -0
  24. data/lib/shenandoah/javascript/common/screw.matchers.js +254 -0
  25. data/lib/shenandoah/javascript/common/screw.mocking.js +22 -0
  26. data/lib/shenandoah/javascript/common/smoke.core.js +6 -0
  27. data/lib/shenandoah/javascript/common/smoke.mock.js +130 -0
  28. data/lib/shenandoah/javascript/common/smoke.stub.js +29 -0
  29. data/lib/shenandoah/javascript/console/consoleReportForRake.js +32 -0
  30. data/lib/shenandoah/javascript/console/env.rhino.js +8841 -0
  31. data/lib/shenandoah/javascript/console/js.jar +0 -0
  32. data/lib/shenandoah/javascript/console/runner.js +43 -0
  33. data/lib/shenandoah/javascript/console/shell.js.erb +23 -0
  34. data/lib/shenandoah/locator.rb +17 -0
  35. data/lib/shenandoah/rails/locator.rb +27 -0
  36. data/lib/shenandoah/rails/tasks.rb +16 -0
  37. data/lib/shenandoah/runner.rb +69 -0
  38. data/lib/shenandoah/server.rb +88 -0
  39. data/lib/shenandoah/server/views/index.haml +12 -0
  40. data/lib/shenandoah/tasks.rb +62 -0
  41. data/rails_generators/shen_spec/shen_spec_generator.rb +27 -0
  42. data/rails_generators/shen_spec/templates/fixture.html.erb +13 -0
  43. data/rails_generators/shen_spec/templates/javascript_spec.js.erb +8 -0
  44. data/rails_generators/shenandoah/shenandoah_generator.rb +21 -0
  45. data/rails_generators/shenandoah/templates/application.html +16 -0
  46. data/rails_generators/shenandoah/templates/application_spec.js +14 -0
  47. data/rails_generators/shenandoah/templates/shenandoah.rake +2 -0
  48. data/rails_generators/shenandoah/templates/spec_helper.js +1 -0
  49. data/shenandoah.gemspec +155 -0
  50. data/spec/rails_generators/shen_spec_generator_spec.rb +81 -0
  51. data/spec/rails_generators/shenandoah_generator_spec.rb +80 -0
  52. data/spec/rails_generators/spec_helper.rb +21 -0
  53. data/spec/shenandoah/buildr/locator_spec.rb +33 -0
  54. data/spec/shenandoah/buildr/shenandoah_tasks_spec.rb +27 -0
  55. data/spec/shenandoah/buildr/spec_helper.rb +2 -0
  56. data/spec/shenandoah/buildr/test_framework_spec.rb +77 -0
  57. data/spec/shenandoah/locator_spec.rb +74 -0
  58. data/spec/shenandoah/rails/locator_spec.rb +57 -0
  59. data/spec/shenandoah/rails/tasks_spec.rb +32 -0
  60. data/spec/shenandoah/runner_spec.rb +110 -0
  61. data/spec/shenandoah/server_spec.rb +216 -0
  62. data/spec/shenandoah/tasks_spec.rb +85 -0
  63. data/spec/spec_helper.rb +61 -0
  64. metadata +262 -0
data/.braids ADDED
@@ -0,0 +1,8 @@
1
+ ---
2
+ vendor/buildr:
3
+ squashed: true
4
+ url: git://github.com/apache/buildr.git
5
+ type: git
6
+ revision: f726a65f42f8ecd4afe36569f448506183fc1d0a
7
+ branch: trunk
8
+ remote: braid/vendor/buildr
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ *.sw?
2
+ .DS_Store
3
+ coverage
4
+ rdoc
5
+ pkg
6
+ spec/tmp
@@ -0,0 +1,13 @@
1
+ 0.1.0
2
+ =====
3
+
4
+ * Supports easier configuration with rails
5
+ * script/generate shenandoah to outfit a rails project
6
+ * script/generate shen_spec *name* to generate a spec and a fixture
7
+
8
+ shenandoah 0.0.0
9
+ ================
10
+
11
+ * Initial version -- extracted from PSC's buildr-ridge extension, which was itself derived from the Blue Ridge JavaScript Testing Plugin
12
+ * Supports buildr
13
+ * Supports generic execution with rake
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Rhett Sutphin
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008-2009 Relevance, Inc.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2008 Nick Kallen
2
+
3
+ Permission is hereby granted, free of charge, to any person
4
+ obtaining a copy of this software and associated documentation
5
+ files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use,
7
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the
9
+ Software is furnished to do so, subject to the following
10
+ conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
data/LICENSE-Smoke ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2008 Andy Kent
2
+
3
+ Permission is hereby granted, free of charge, to any person
4
+ obtaining a copy of this software and associated documentation
5
+ files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use,
7
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the
9
+ Software is furnished to do so, subject to the following
10
+ conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
data/README.markdown ADDED
@@ -0,0 +1,280 @@
1
+ Shenandoah JavaScript Testing metapackage
2
+ =========================================
3
+
4
+ Shenandoah adds support for command-line and in-browser JavaScript unit tests in your buildr, rails, or other rake-using project. It bundles several great tools together in a convention-over-configuration, Rails-like way. These tools include:
5
+
6
+ * `Rhino` - a Java-based JavaScript interpreter
7
+ * `Screw.Unit` - a behaviour-driven development syntax for JavaScript similar to RSpec
8
+ * `Smoke` - a JavaScript mocking & stubbing library similar to Mocha
9
+ * `env.js` - a DOM implementation written entirely in JavaScript
10
+
11
+ Shenandoah is a generalization of the [Blue Ridge][blue-ridge] plugin for rails. (See below for differences.)
12
+
13
+ [blue-ridge]: http://github.com/relevance/blue-ridge
14
+
15
+ General Use
16
+ -----------
17
+
18
+ Shenandoah provides a command-line runner and a server to enable in-browser testing with simple path management.
19
+
20
+ The command-line runner is a lot like any other test framework's: It runs some or all of the specs and tells you which ones fail.
21
+
22
+ The server (after you start it), is available at [http://localhost:4410/](http://localhost:4410/). The root path will give you a list of specs, linked to the pages where you can run them.
23
+
24
+ Shenandoah also provides an interactive shell a la `irb`. You can use it to experiment with javascript in a similar context to the command line runner.
25
+
26
+ The following sections describe how to invoke Shenandoah with various build systems.
27
+
28
+ Installing and Running
29
+ ----------------------
30
+
31
+ To install:
32
+
33
+ $ gem install shenandoah
34
+
35
+ ### Use with buildr
36
+
37
+ # In your buildfile
38
+ require 'shenandoah/buildr'
39
+ # ...
40
+ define :web_js do
41
+ test.using :shenandoah, :main_path => project('web')._("src/main/webapp/js")
42
+ end
43
+
44
+ In buildr, Shenandoah expects to find your specs in the `src/spec/javascript` directory. The main path defaults to `src/main/javascript`, but may be changed as in the example.
45
+
46
+ To run the specs from the command line:
47
+
48
+ $ buildr web_js:test
49
+
50
+ To run an individual spec file called "application_spec.js":
51
+
52
+ $ cd web_js
53
+ web_js$ buildr test:application
54
+
55
+ To start the server:
56
+
57
+ $ buildr web_js:shen:serve
58
+
59
+ To start the shell:
60
+
61
+ $ buildr web_js:shen:shell
62
+
63
+ ### Use with Rails
64
+
65
+ Add a config.gem entry in environment.rb:
66
+
67
+ config.gem "shenandoah", :version => '0.1.0', :lib => false
68
+
69
+ Install the rake tasks:
70
+
71
+ $ script/generate shenandoah
72
+
73
+ In a rails project, Shenandoah will look for specs in `spec/javascript`, `examples/javascript`, or `test/javascript`. The main path is `public/javascripts`.
74
+
75
+ To run the specs from the command line:
76
+
77
+ $ rake shen:spec
78
+
79
+ To run an individual spec file called "application_spec.js":
80
+
81
+ $ rake shen:spec SHEN_SPEC=application
82
+
83
+ To start the server:
84
+
85
+ $ rake shen:serve
86
+
87
+ To start the shell:
88
+
89
+ $ rake shen:shell
90
+
91
+ ### Use with rake (in general)
92
+
93
+ # In your Rakefile
94
+ require 'rubygems'
95
+ require 'shenandoah/tasks'
96
+ Shenandoah::Tasks.new(:main_path => 'public/javascript', :spec_path => 'test/javascript')
97
+
98
+ With plain rake, Shenandoah defaults to `lib` for the main path and `spec` for the spec path.
99
+
100
+ To run all the specs from the command_line:
101
+
102
+ $ rake shen:spec
103
+
104
+ To run an individual spec file called "application_spec.js":
105
+
106
+ $ rake shen:spec SHEN_SPEC=application
107
+
108
+ To start the server:
109
+
110
+ $ rake shen:serve
111
+
112
+ To start the shell:
113
+
114
+ $ rake shen:shell
115
+
116
+ Specs and Fixtures
117
+ ------------------
118
+
119
+ Each Shenandoah spec is two files: a javascript spec (e.g. `name_spec.js`) and and HTML fixture (e.g. `name.html`). The spec contains the the actual Screw.Unit test definitions. The fixture contains the DOM that the spec (or the code under test) relies on to work.
120
+
121
+ Example Using jQuery
122
+ --------------------
123
+
124
+ Shenandoah is opinionated and assumes you're using jQuery by default. The plugin itself actually uses jQuery under the covers to run Screw.Unit.
125
+
126
+ require_spec("spec_helper.js");
127
+ require_main("application.js");
128
+
129
+ Screw.Unit(function() {
130
+ describe("Your application javascript", function() {
131
+ it("does something", function() {
132
+ expect("hello").to(equal, "hello");
133
+ });
134
+
135
+ it("accesses the DOM from fixtures/application.html", function() {
136
+ expect($('.select_me').length).to(equal, 2);
137
+ });
138
+ });
139
+ });
140
+
141
+ (By the way, we don’t actually encourage you to write specs and tests for standard libraries like JQuery and Prototype. It just makes for an easy demo.)
142
+
143
+ Example Using Prototype
144
+ -----------------------
145
+
146
+ It's very easy to add support for Prototype. Here's an example spec:
147
+
148
+ jQuery.noConflict();
149
+
150
+ require_spec("spec_helper.js");
151
+ require_main("prototype.js");
152
+ require_main("application.js");
153
+
154
+ Screw.Unit(function() {
155
+ describe("Your application javascript", function() {
156
+ it("does something", function() {
157
+ expect("hello").to(equal, "hello");
158
+ });
159
+
160
+ it("accesses the DOM from fixtures/application.html", function() {
161
+ expect($$('.select_me').length).to(equal, 2);
162
+ });
163
+ });
164
+ });
165
+
166
+ More Examples
167
+ -------------
168
+
169
+ To see Shenandoah in action inside a working Rails app, check out the [Shenandoah sample application](http://github.com/rsutphin/shenandoah-rails-sample-app). Among other things, this sample app includes examples of:
170
+
171
+ * using nested `describe` functions
172
+ * setting up per-spec HTML "fixtures"
173
+ * stubbing functions
174
+ * mocking functions
175
+ * running the javascript specs as part of your default Rake task
176
+
177
+ JavaScript API
178
+ --------------
179
+
180
+ Shenandoah provides a handful of functions that help you write specs that can run inside a web browser as well from the Rhino command-line test runner.
181
+
182
+ ### require_main(filename)
183
+
184
+ Loads a dependency from the main path.
185
+
186
+ When running from the command line, `require_main` becomes a Rhino call to `load`, resolving the file against the configured `main_path`. In a web browser, `require_main` loads and evaluates the script using a synchronous background request to ensure that all the scripts are loaded in order.
187
+
188
+ ### require_spec(filename)
189
+
190
+ Loads a dependency from the spec path.
191
+
192
+ Just like `require_main`, but for spec files.
193
+
194
+ The Shell
195
+ ---------
196
+
197
+ Shenandoah provides an `irb`-like JavaScript shell for debugging your JavaScript code. jQuery and env.js are pre-loaded for you to make debugging DOM code easy.
198
+
199
+ =================================================
200
+ Rhino JavaScript Shell
201
+ To exit type 'exit', 'quit', or 'quit()'.
202
+ =================================================
203
+ - loaded env.js
204
+ - sample DOM loaded
205
+ - jQuery-1.2.6 loaded
206
+ =================================================
207
+ Rhino 1.7 release 2 PRERELEASE 2008 07 28
208
+ js> print("Hello World!")
209
+ Hello World!
210
+ js>
211
+
212
+ Note that if you have `rlwrap` installed and on the command line path (and you really, really should!), then command-line history and readline arrow-up and down will be properly supported automatically. (You can get `rlwrap` from your friendly neighborhood package manager.)
213
+
214
+ Mocking Example with Smoke
215
+ --------------------------
216
+
217
+ Smoke is a JavaScript mocking and stubbing toolkit that is somewhat similar to FlexMock or Mocha. It is automatically wired-in to undo its mocking after each Screw.Unit `it` block. Here's an example.
218
+
219
+ it("calculates the total cost of a contract by adding the prices of each component", function() {
220
+ var componentX = {}, componentY = {};
221
+ mock(SalesContract).should_receive("calculateComponentPrice").with_arguments(componentX).exactly(1, "times").and_return(42);
222
+ mock(SalesContract).should_receive("calculateComponentPrice").with_arguments(componentY).exactly(1, "times").and_return(24);
223
+ expect(SalesContract.calculateTotalCost([componentX, componentY])).to(equal, 66);
224
+ });
225
+
226
+ Note that the flexible nature of the JavaScript the language means that you might not need to use Smoke, especially for stubbing.
227
+
228
+ Tips & Tricks
229
+ -------------
230
+ * Avoid using `print` in your tests while debugging. It works fine from the command line but causes lots of headaches in browser. (Just imagine a print dialog opening ten or fifteen times and then Firefox crashing. This is a mistake I've made too many times! Trust me!)
231
+
232
+ Bugs & Patches
233
+ --------------
234
+
235
+ If you see any bugs or possible improvements, please use the project's [GitHub issue tracker](http://github.com/rsutphin/shenandoah/issues) to report them.
236
+
237
+ If you like, you could even fork the [GitHub repo](http://www.github.com/rsutphin/shenandoah) and start hacking.
238
+
239
+ Differences from Blue Ridge
240
+ ---------------------------
241
+
242
+ Shenandoah is based on the [Blue Ridge JavaScript Testing Rails Plugin][blue-ridge]. The main difference is that it works for any project that uses rake or buildr, not just rails projects. If you are using a rails project, you might consider using Shenandoah instead of Blue Ridge anyway:
243
+
244
+ * Blue Ridge requires all specs to be in the same directory (subdirectories are not allowed). Shenandoah does not have this limitation.
245
+ * Shenandoah's design places the spec js and the fixture html in the same directory. Blue Ridge puts them in separate directories, leading to parallel hierarchies.
246
+ * Shenandoah provides an in-browser index for the specs. Blue Ridge requires opening each HTML fixture separately.
247
+
248
+ The cost for all this is that Shenandoah fixtures can't be opened directly in the browser — they can only be opened via the server.
249
+
250
+ Links
251
+ -----
252
+
253
+ * [Blue Ridge JavaScript Testing Rails Plugin](http://github.com/relevance/blue-ridge)
254
+ * [Blue Ridge Sample App](http://github.com/relevance/blue-ridge-sample-app)
255
+ * [Justin Gehtland's "Fully Headless JSSpec" Blog Post](http://blog.thinkrelevance.com/2008/7/31/fully-headless-jsspec)
256
+ * [Screw.Unit](http://github.com/nkallen/screw-unit)
257
+ * [Screw.Unit Mailing List](http://groups.google.com/group/screw-unit)
258
+ * [Smoke](http://github.com/andykent/smoke)
259
+ * [env.js](http://github.com/thatcher/env-js)
260
+ * [env.js Mailing List](http://groups.google.com/group/envjs)
261
+ * [Mozilla Rhino](http://www.mozilla.org/rhino/)
262
+ * [W3C DOM Specifications](http://www.w3.org/DOM/DOMTR)
263
+
264
+ Contributors
265
+ ------------
266
+ * Justin Gehtland
267
+ * Geof Dagley
268
+ * Larry Karnowski
269
+ * Chris Thatcher (for numerous env.js bug fixes!)
270
+ * Raimonds Simanovskis
271
+ * Jason Rudolph
272
+
273
+ Copyrights
274
+ ------------
275
+ * Copyright © 2009 Rhett Sutphin, under the MIT license
276
+ * Based on blue-ridge, Copyright 2008-2009 [Relevance, Inc.](http://www.thinkrelevance.com/), under the MIT license
277
+ * env.js - Copyright 2007-2009 John Resig, under the MIT License
278
+ * Screw.Unit - Copyright 2008 Nick Kallen, license attached
279
+ * Rhino - Copyright 2009 Mozilla Foundation, GPL 2.0
280
+ * Smoke - Copyright 2008 Andy Kent, license attached
data/Rakefile ADDED
@@ -0,0 +1,71 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "shenandoah"
8
+ gem.summary = %Q{A javascript test framework for buildr, rails, and other ruby-built projects}
9
+ gem.email = "rhett@detailedbalance.net"
10
+ gem.homepage = "http://github.com/rsutphin/shenandoah"
11
+ gem.authors = ["Rhett Sutphin"]
12
+ gem.rubyforge_project = "detailedbalance"
13
+
14
+ # Exclude test-only vendored buildr
15
+ gem.files.exclude("vendor/**/*")
16
+
17
+ gem.add_runtime_dependency('sinatra', '>= 0.9.2')
18
+ gem.add_runtime_dependency('haml', '>= 2.0.9')
19
+ gem.add_runtime_dependency('rake')
20
+ gem.add_runtime_dependency('rails', '>= 2.1.0')
21
+
22
+ # Have to use rspec 1.2.4 for buildr compat
23
+ gem.add_development_dependency('rspec', '= 1.2.4')
24
+ gem.add_development_dependency('rack-test', '>= 0.3.0')
25
+ gem.add_development_dependency('rspec_hpricot_matchers', '>= 1.0.0')
26
+ gem.add_development_dependency('braid', '>= 0.5.0')
27
+
28
+ # These are the dependencies for the vendored buildr (used for testing)
29
+ gem.add_development_dependency('rake', '= 0.8.4')
30
+ gem.add_development_dependency('net-ssh', '= 2.0.11')
31
+ gem.add_development_dependency('net-sftp', '= 2.0.2')
32
+ gem.add_development_dependency('highline', '= 1.5.0')
33
+ gem.add_development_dependency('hoe', '= 1.12.2')
34
+ end
35
+
36
+ Jeweler::RubyforgeTasks.new
37
+ rescue LoadError
38
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
39
+ end
40
+
41
+ require 'spec/rake/spectask'
42
+ Spec::Rake::SpecTask.new(:spec) do |spec|
43
+ spec.libs << 'lib' << 'spec'
44
+ spec.spec_files = FileList['spec/**/*_spec.rb']
45
+ end
46
+
47
+ Spec::Rake::SpecTask.new(:rcov) do |spec|
48
+ spec.libs << 'lib' << 'spec'
49
+ spec.pattern = 'spec/**/*_spec.rb'
50
+ spec.rcov = true
51
+ # rcov can't tell that /Library/Ruby is a system path
52
+ spec.rcov_opts = ['--exclude', "spec/*,/Library/Ruby/*"]
53
+ end
54
+
55
+ task :default => :spec
56
+
57
+ require 'rake/rdoctask'
58
+ Rake::RDocTask.new do |rdoc|
59
+ if File.exist?('VERSION.yml')
60
+ config = YAML.load(File.read('VERSION.yml'))
61
+ version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
62
+ else
63
+ version = ""
64
+ end
65
+
66
+ rdoc.rdoc_dir = 'rdoc'
67
+ rdoc.title = "shenandoah #{version}"
68
+ rdoc.rdoc_files.include('README*')
69
+ rdoc.rdoc_files.include('lib/**/*.rb')
70
+ end
71
+