guard-jasmine 0.7.2 → 0.8.0
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/README.md +214 -109
- data/bin/guard-jasmine +2 -4
- data/bin/guard-jasmine-debug +3 -0
- data/lib/guard/jasmine/cli.rb +85 -0
- data/lib/guard/jasmine/version.rb +1 -1
- metadata +42 -23
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Guard::Jasmine automatically tests your Jasmine specs when files are modified.
|
4
4
|
|
5
|
-
Tested on MRI Ruby 1.8.7, 1.9.2, REE and the latest versions of JRuby & Rubinius.
|
5
|
+
Tested on MRI Ruby 1.8.7, 1.9.2, 1.9.3, REE and the latest versions of JRuby & Rubinius.
|
6
6
|
|
7
7
|
If you have any questions please join us on our [Google group](http://groups.google.com/group/guard-dev) or on `#guard`
|
8
8
|
(irc.freenode.net).
|
@@ -18,6 +18,8 @@ various web standards: DOM handling, CSS selector, JSON, Canvas, and SVG.
|
|
18
18
|
* Runs the standard Jasmine test runner, so you can use [Jasminerice][] for integrating [Jasmine][] into the
|
19
19
|
[Rails 3.1 asset pipeline][] and write your specs in [CoffeeScript][].
|
20
20
|
|
21
|
+
* Command line helper for CI server integration.
|
22
|
+
|
21
23
|
* Runs on Mac OS X, Linux and Windows.
|
22
24
|
|
23
25
|
## How it works
|
@@ -39,19 +41,22 @@ various web standards: DOM handling, CSS selector, JSON, Canvas, and SVG.
|
|
39
41
|
|
40
42
|
### Guard and Guard::Jasmine
|
41
43
|
|
42
|
-
|
43
|
-
|
44
|
-
Install the gem:
|
44
|
+
The simplest way to install Guard is to use [Bundler](http://gembundler.com/).
|
45
|
+
Please make sure to have [Guard][] installed.
|
45
46
|
|
46
|
-
|
47
|
+
Add Guard::Jasmine to your `Gemfile`:
|
47
48
|
|
48
|
-
|
49
|
+
```ruby
|
50
|
+
group :development do
|
51
|
+
gem 'guard-jasmine'
|
52
|
+
end
|
53
|
+
```
|
49
54
|
|
50
|
-
|
55
|
+
Add the default Guard::Jasmine template to your `Guardfile` by running:
|
51
56
|
|
52
|
-
|
53
|
-
|
54
|
-
|
57
|
+
```bash
|
58
|
+
$ guard init jasmine
|
59
|
+
```
|
55
60
|
|
56
61
|
### Jasminerice
|
57
62
|
|
@@ -62,20 +67,26 @@ Please read the detailed installation and configuration instructions at [Jasmine
|
|
62
67
|
|
63
68
|
In short, you add it to your `Gemfile`:
|
64
69
|
|
65
|
-
|
66
|
-
|
67
|
-
|
70
|
+
```ruby
|
71
|
+
group :development, :test do
|
72
|
+
gem 'jasminerice'
|
73
|
+
end
|
74
|
+
```
|
68
75
|
|
69
76
|
and add a route for the Jasmine Test Runner to `config/routes.rb`:
|
70
77
|
|
71
|
-
|
72
|
-
|
73
|
-
|
78
|
+
```ruby
|
79
|
+
if ["development", "test"].include? Rails.env
|
80
|
+
mount Jasminerice::Engine => "/jasmine"
|
81
|
+
end
|
82
|
+
```
|
74
83
|
|
75
84
|
Next you create the directory `spec/javascripts` where your CoffeeScript tests go into. You define the Rails 3.1
|
76
85
|
asset pipeline manifest in `spec/javascripts/spec.js.coffee`:
|
77
86
|
|
78
|
-
|
87
|
+
```coffeescript
|
88
|
+
#=require_tree ./
|
89
|
+
```
|
79
90
|
|
80
91
|
### PhantomJS
|
81
92
|
|
@@ -84,13 +95,17 @@ You need the PhantomJS browser installed on your system. You can download binari
|
|
84
95
|
|
85
96
|
Alternatively you can install [Homebrew][] on Mac OS X and install it with:
|
86
97
|
|
87
|
-
|
98
|
+
```bash
|
99
|
+
$ brew install phantomjs
|
100
|
+
```
|
88
101
|
|
89
102
|
If you are using Ubuntu 10.10, you can install it with apt:
|
90
103
|
|
91
|
-
|
92
|
-
|
93
|
-
|
104
|
+
```bash
|
105
|
+
$ sudo add-apt-repository ppa:jerome-etienne/neoip
|
106
|
+
$ sudo apt-get update
|
107
|
+
$ sudo apt-get install phantomjs
|
108
|
+
```
|
94
109
|
|
95
110
|
You can also build it from source for several other operating systems, please consult the
|
96
111
|
[PhantomJS build instructions][].
|
@@ -104,46 +119,54 @@ Please read the [Guard usage documentation](https://github.com/guard/guard#readm
|
|
104
119
|
Guard::Jasmine can be adapted to all kind of projects. Please read the
|
105
120
|
[Guard documentation](https://github.com/guard/guard#readme) for more information about the Guardfile DSL.
|
106
121
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
122
|
+
```ruby
|
123
|
+
guard 'jasmine' do
|
124
|
+
watch(%r{app/assets/javascripts/(.+)\.(js\.coffee|js)}) { |m| "spec/javascripts/#{m[1]}_spec.#{m[2]}" }
|
125
|
+
watch(%r{spec/javascripts/(.+)_spec\.(js\.coffee|js)}) { |m| "spec/javascripts/#{m[1]}_spec.#{m[2]}" }
|
126
|
+
watch(%r{spec/javascripts/spec\.(js\.coffee|js)}) { "spec/javascripts" }
|
127
|
+
end
|
128
|
+
```
|
112
129
|
|
113
130
|
## Options
|
114
131
|
|
115
132
|
There are many options that can customize Guard::Jasmine to your needs. Options are simply supplied as hash when
|
116
133
|
defining the Guard in your `Guardfile`:
|
117
134
|
|
118
|
-
|
119
|
-
|
120
|
-
|
135
|
+
```ruby
|
136
|
+
guard 'jasmine', :all_on_start => false, :specdoc => :always do
|
137
|
+
...
|
138
|
+
end
|
139
|
+
```
|
121
140
|
|
122
141
|
### General options
|
123
142
|
|
124
143
|
The general options configures the environment that is needed to run Guard::Jasmine:
|
125
144
|
|
126
|
-
|
127
|
-
|
145
|
+
```ruby
|
146
|
+
:jasmine_url => 'http://192.168.1.5/jasmine' # URL where Jasmine is served.
|
147
|
+
# default: http://127.0.0.1/jasmine
|
128
148
|
|
129
|
-
|
130
|
-
|
149
|
+
:phantomjs_bin => '~/bin/phantomjs' # Path to phantomjs.
|
150
|
+
# default: '/usr/local/bin/phantomjs'
|
131
151
|
|
132
|
-
|
133
|
-
|
152
|
+
:timeout => 20000 # The time in ms to wait for the spec runner to finish.
|
153
|
+
# default: 10000
|
154
|
+
```
|
134
155
|
|
135
156
|
### Spec runner options
|
136
157
|
|
137
158
|
The spec runner options configures the behavior driven development (or BDD) cycle:
|
138
159
|
|
139
|
-
|
140
|
-
|
160
|
+
```ruby
|
161
|
+
:all_on_start => false # Run all suites on start.
|
162
|
+
# default: true
|
141
163
|
|
142
|
-
|
143
|
-
|
164
|
+
:keep_failed => false # Keep failed suites and add them to the next run again.
|
165
|
+
# default: true
|
144
166
|
|
145
|
-
|
146
|
-
|
167
|
+
:all_after_pass => false # Run all suites after a suite has passed again after failing.
|
168
|
+
# default: true
|
169
|
+
```
|
147
170
|
|
148
171
|
The `:keep_failed` failed option remembers failed suites and not failed specs. The reason for this decision is to
|
149
172
|
avoid additional round trip time to request the Jasmine test runner for each single spec, which is mostly more expensive
|
@@ -154,14 +177,16 @@ than running a whole suite.
|
|
154
177
|
Guard::Jasmine can generate an RSpec like specdoc in the console after running the specs and you can set when it will
|
155
178
|
be shown in the console:
|
156
179
|
|
157
|
-
|
158
|
-
|
180
|
+
```ruby
|
181
|
+
:specdoc => :always # Specdoc output options, either :always, :never or :failure
|
182
|
+
# default: :failure
|
159
183
|
|
160
|
-
|
161
|
-
|
184
|
+
:focus => false # Specdoc focus to hide successful specs when at least one spec fails.
|
185
|
+
# default: true
|
162
186
|
|
163
|
-
|
164
|
-
|
187
|
+
:console => :always # Console.log output options, either :always, :never or :failure
|
188
|
+
# default: :failure
|
189
|
+
```
|
165
190
|
|
166
191
|
With the option set to `:always`, the specdoc is shown with and without errors in your spec, whereas on with the option
|
167
192
|
set to `:never`, there is no output at all, instead just a summary of the spec run is shown. The default option
|
@@ -176,11 +201,15 @@ to see support for more console methods coming to PhantomJS.
|
|
176
201
|
|
177
202
|
Another restriction on console logging is that currently only the first log parameter is passed. So instead of writing
|
178
203
|
|
179
|
-
|
204
|
+
```javascript
|
205
|
+
console.log('Debug of %o with %s', object, string)
|
206
|
+
```
|
180
207
|
|
181
208
|
your should write
|
182
209
|
|
183
|
-
|
210
|
+
```javascript
|
211
|
+
console.log('Debug of ' + object.toString() + ' width ' + string)
|
212
|
+
```
|
184
213
|
|
185
214
|
You can also give your vote on [Issue 36](http://code.google.com/p/phantomjs/issues/detail?id=36) to see support for
|
186
215
|
multiple console arguments.
|
@@ -189,14 +218,16 @@ multiple console arguments.
|
|
189
218
|
|
190
219
|
These options affects what system notifications (growl, libnotify or notifu) are shown after a spec run:
|
191
220
|
|
192
|
-
|
193
|
-
|
221
|
+
```ruby
|
222
|
+
:notifications => false # Show success and error notifications.
|
223
|
+
# default: true
|
194
224
|
|
195
|
-
|
196
|
-
|
225
|
+
:hide_success => true # Disable successful spec run notification.
|
226
|
+
# default: false
|
197
227
|
|
198
|
-
|
199
|
-
|
228
|
+
:max_error_notify => 5 # Maximum error notifications to show.
|
229
|
+
# default: 3
|
230
|
+
```
|
200
231
|
|
201
232
|
## A note on Rails 2 and 3
|
202
233
|
|
@@ -207,54 +238,60 @@ it's freely up to you how you'll prepare the assets and serve the Jasmine runner
|
|
207
238
|
You can use [the Jasmine Gem][], configure the test suite in `jasmine.yml` and start the Jasmine test runner with
|
208
239
|
the supplied Rake task:
|
209
240
|
|
210
|
-
|
241
|
+
```bash
|
242
|
+
$ rake jasmine
|
243
|
+
```
|
211
244
|
|
212
245
|
Next follows an example on how to configure your `Guardfile` with the Jasmine gem:
|
213
246
|
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
247
|
+
```ruby
|
248
|
+
guard 'jasmine', :jasmine_url => 'http://127.0.0.1:8888' do
|
249
|
+
watch(%r{public/javascripts/(.+)\.js}) { |m| "spec/javascripts/#{m[1]}_spec.js" }
|
250
|
+
watch(%r{spec/javascripts/(.+)_spec\.js}) { |m| "spec/javascripts/#{m[1]}_spec.js" }
|
251
|
+
watch(%r{spec/javascripts/support/jasmine\.yml}) { "spec/javascripts" }
|
252
|
+
watch(%r{spec/javascripts/support/jasmine_config\.rb}) { "spec/javascripts" }
|
253
|
+
end
|
254
|
+
```
|
220
255
|
|
221
256
|
You can also use [guard-process](https://github.com/socialreferral/guard-process) to start the Jasmine Gem server when
|
222
257
|
Guard starts:
|
223
258
|
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
end
|
259
|
+
```ruby
|
260
|
+
guard 'process', :name => 'Jasmine server', :command => 'bundle exec rake jasmine' do
|
261
|
+
watch(%r{spec/javascripts/support/*})
|
262
|
+
end
|
263
|
+
|
264
|
+
JASMINE_HOST = '127.0.0.1'
|
265
|
+
JASMINE_PORT = '8888'
|
266
|
+
JASMINE_URL = "http://#{JASMINE_HOST}:#{JASMINE_PORT}/"
|
267
|
+
|
268
|
+
Thread.new do
|
269
|
+
require 'socket'
|
270
|
+
|
271
|
+
puts "\nWaiting for Jasmine to accept connections on #{JASMINE_URL}..."
|
272
|
+
wait_for_open_connection(JASMINE_HOST, JASMINE_PORT)
|
273
|
+
puts "Jasmine is now ready to accept connections; change a file or press ENTER run your suite."
|
274
|
+
puts "You can also view and run specs by visiting:"
|
275
|
+
puts JASMINE_URL
|
276
|
+
|
277
|
+
guard 'jasmine', :jasmine_url => JASMINE_URL do
|
278
|
+
watch(%r{public/javascripts/(.+)\.js}) { |m| "spec/javascripts/#{m[1]}_spec.js" }
|
279
|
+
watch(%r{spec/javascripts/(.+)_spec\.js}) { |m| "spec/javascripts/#{m[1]}_spec.js" }
|
280
|
+
watch(%r{spec/javascripts/support/jasmine\.yml}) { "spec/javascripts" }
|
281
|
+
watch(%r{spec/javascripts/support/jasmine_config\.rb}) { "spec/javascripts" }
|
282
|
+
end
|
283
|
+
end
|
284
|
+
|
285
|
+
def wait_for_open_connection(host, port)
|
286
|
+
while true
|
287
|
+
begin
|
288
|
+
TCPSocket.new(host, port).close
|
289
|
+
return
|
290
|
+
rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH
|
257
291
|
end
|
292
|
+
end
|
293
|
+
end
|
294
|
+
```
|
258
295
|
|
259
296
|
This elegant solution is provided by [Jason Morrison](http://twitter.com/#!/jayunit), see his original
|
260
297
|
[Gist](https://gist.github.com/1224382).
|
@@ -262,8 +299,57 @@ This elegant solution is provided by [Jason Morrison](http://twitter.com/#!/jayu
|
|
262
299
|
It is also possible to use CoffeeScript in this setup, by using [Guard::CoffeeScript][] to compile your code and even
|
263
300
|
specs. Just add something like this *before* Guard::Jasmine:
|
264
301
|
|
265
|
-
|
266
|
-
|
302
|
+
```ruby
|
303
|
+
guard 'coffeescript', :input => 'app/coffeescripts', :output => 'public/javascripts'
|
304
|
+
guard 'coffeescript', :input => 'spec/coffeescripts', :output => 'spec/javascripts'
|
305
|
+
```
|
306
|
+
|
307
|
+
## Guard::Jasmine for your CI server
|
308
|
+
|
309
|
+
Guard::Jasmine includes a little command line utility to run your specs once and output the specdoc to the console.
|
310
|
+
|
311
|
+
```bash
|
312
|
+
$ guard-jasmine
|
313
|
+
```
|
314
|
+
|
315
|
+
You can get help on the available options with the `help` task:
|
316
|
+
|
317
|
+
```bash
|
318
|
+
$ guard-jasmine help start
|
319
|
+
Usage:
|
320
|
+
guard-jasmine start
|
321
|
+
|
322
|
+
Options:
|
323
|
+
-u, [--url=URL] # The url of the Jasmine test runner
|
324
|
+
# Default: http://127.0.0.1:3000/jasmine
|
325
|
+
-b, [--bin=BIN] # The location of the PhantomJS binary
|
326
|
+
# Default: /usr/local/bin/phantomjs
|
327
|
+
-t, [--timeout=N] # The maximum time in milliseconds to wait for the spec runner to finish
|
328
|
+
# Default: 10000
|
329
|
+
-c, [--console=CONSOLE] # Whether to show console.log statements in the spec runner, either `always`, `never` or `failure`
|
330
|
+
# Default: failure
|
331
|
+
```
|
332
|
+
|
333
|
+
By default all specs are run, but you can supply multiple paths to your specs to run only a subset:
|
334
|
+
|
335
|
+
```bash
|
336
|
+
$ guard-jasmine spec/javascripts/a_spec.js.coffee spec/javascripts/another_spec.js.coffee
|
337
|
+
```
|
338
|
+
|
339
|
+
### Travis CI integration
|
340
|
+
|
341
|
+
With the given `guard-jasmine` script you're able to configure [Travis CI](http://travis-ci.org/) to run Guard::Jasmine.
|
342
|
+
Simply use the `script` setting in your `.travis.yml`:
|
343
|
+
|
344
|
+
```yaml
|
345
|
+
script: 'bundle exec guard-jasmine'
|
346
|
+
```
|
347
|
+
|
348
|
+
You can also run your Guard::Jasmine specs after your specs that are ran with `rake` by using `after_script`:
|
349
|
+
|
350
|
+
```yaml
|
351
|
+
after_script: 'bundle exec guard-jasmine'
|
352
|
+
```
|
267
353
|
|
268
354
|
## Alternatives
|
269
355
|
|
@@ -273,34 +359,53 @@ continuous testing support.
|
|
273
359
|
* [Jezebel][] a Node.js REPL and continuous test runner for [Jessie][], a Node runner for Jasmine, but has no full
|
274
360
|
featured browser environment.
|
275
361
|
|
362
|
+
## Issues
|
363
|
+
|
364
|
+
You can report issues and feature requests to [GitHub Issues](https://github.com/netzpirat/guard-jasmine/issues). Try to figure out
|
365
|
+
where the issue belongs to: Is it an issue with Guard itself or with Guard::Jasmine? Please don't
|
366
|
+
ask question in the issue tracker, instead join us in our [Google group](http://groups.google.com/group/guard-dev) or on
|
367
|
+
`#guard` (irc.freenode.net).
|
368
|
+
|
369
|
+
When you file an issue, please try to follow to these simple rules if applicable:
|
370
|
+
|
371
|
+
* Make sure you run Guard with `bundle exec` first.
|
372
|
+
* Add debug information to the issue by running Guard with the `--debug` option.
|
373
|
+
* Add your `Guardfile` and `Gemfile` to the issue.
|
374
|
+
* Make sure that the issue is reproducible with your description.
|
375
|
+
|
276
376
|
## Development
|
277
377
|
|
278
378
|
- Documentation hosted at [RubyDoc](http://rubydoc.info/github/guard/guard-jasmine/master/frames).
|
279
379
|
- Source hosted at [GitHub](https://github.com/netzpirat/guard-jasmine).
|
280
|
-
- Report issues and feature requests to [GitHub Issues](https://github.com/netzpirat/guard-jasmine/issues).
|
281
380
|
|
282
|
-
Pull requests are very welcome! Please try to follow these simple
|
381
|
+
Pull requests are very welcome! Please try to follow these simple rules if applicable:
|
283
382
|
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
383
|
+
* Please create a topic branch for every separate change you make.
|
384
|
+
* Make sure your patches are well tested.
|
385
|
+
* Update the [Yard](http://yardoc.org/) documentation.
|
386
|
+
* Update the README.
|
387
|
+
* Update the CHANGELOG for noteworthy changes.
|
388
|
+
* Please **do not change** the version number.
|
288
389
|
|
289
|
-
For questions please join us
|
290
|
-
(irc.freenode.net).
|
390
|
+
For questions please join us in our [Google group](http://groups.google.com/group/guard-dev) or on
|
391
|
+
`#guard` (irc.freenode.net).
|
291
392
|
|
292
|
-
### The guard-jasmine executable
|
393
|
+
### The guard-jasmine-debug executable
|
293
394
|
|
294
|
-
This Guard comes with a small executable `guard-jasmine` that can be used to run the Jasmine test runner on PhantomJS
|
395
|
+
This Guard comes with a small executable `guard-jasmine-debug` that can be used to run the Jasmine test runner on PhantomJS
|
295
396
|
and see the JSON result that gets evaluated by Guard::Jasmine. This comes handy when there is an issue with your specs
|
296
397
|
and you want to see the output of the PhantomJS script.
|
297
398
|
|
298
|
-
|
399
|
+
```bash
|
400
|
+
$ guard-jasmine-debug
|
401
|
+
```
|
299
402
|
|
300
403
|
The only argument that the script takes is the URL to the Jasmine runner, which defaults to
|
301
404
|
`http://127.0.0.1:3000/Jasmine`. So you can for example just run a subset of the specs by changing the URL:
|
302
405
|
|
303
|
-
|
406
|
+
```bash
|
407
|
+
$ guard-jasmine-debug http://127.0.0.1:3000/Jasmine?spec=YourSpec
|
408
|
+
```
|
304
409
|
|
305
410
|
## Acknowledgment
|
306
411
|
|
data/bin/guard-jasmine
CHANGED
@@ -1,5 +1,3 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
puts `phantomjs #{ script } #{ ARGV[0] } #{ ARGV[1] }`
|
2
|
+
require 'guard/jasmine/cli'
|
3
|
+
Guard::Jasmine::CLI.start
|
@@ -0,0 +1,85 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'guard/ui'
|
3
|
+
require 'guard/jasmine/version'
|
4
|
+
require 'guard/jasmine/runner'
|
5
|
+
require 'guard/jasmine/formatter'
|
6
|
+
|
7
|
+
module Guard
|
8
|
+
class Jasmine
|
9
|
+
|
10
|
+
# Small helper class to run the Jasmine runner once from the
|
11
|
+
# command line. This can be useful to integrate guard-jasmine
|
12
|
+
# into a continuous integration server.
|
13
|
+
#
|
14
|
+
# This outputs the specdoc and disables any notifications.
|
15
|
+
#
|
16
|
+
class CLI < Thor
|
17
|
+
|
18
|
+
default_task :spec
|
19
|
+
|
20
|
+
desc 'spec', 'Run the Jasmine spec runner'
|
21
|
+
|
22
|
+
method_option :url,
|
23
|
+
:type => :string,
|
24
|
+
:aliases => '-u',
|
25
|
+
:default => 'http://127.0.0.1:3000/jasmine',
|
26
|
+
:desc => 'The url of the Jasmine test runner'
|
27
|
+
|
28
|
+
method_option :bin,
|
29
|
+
:type => :string,
|
30
|
+
:aliases => '-b',
|
31
|
+
:default => '/usr/local/bin/phantomjs',
|
32
|
+
:desc => 'The location of the PhantomJS binary'
|
33
|
+
|
34
|
+
method_option :timeout,
|
35
|
+
:type => :numeric,
|
36
|
+
:aliases => '-t',
|
37
|
+
:default => 10000,
|
38
|
+
:desc => 'The maximum time in milliseconds to wait for the spec runner to finish'
|
39
|
+
|
40
|
+
method_option :console,
|
41
|
+
:type => :string,
|
42
|
+
:aliases => '-c',
|
43
|
+
:default => 'failure',
|
44
|
+
:desc => 'Whether to show console.log statements in the spec runner, either `always`, `never` or `failure`'
|
45
|
+
|
46
|
+
# Run the Guard::Jasmine::Runner with options from
|
47
|
+
# the command line.
|
48
|
+
#
|
49
|
+
# @param [Array<String>] paths the name of the specs to run
|
50
|
+
#
|
51
|
+
def spec(*paths)
|
52
|
+
paths = ['spec/javascripts'] if paths.empty?
|
53
|
+
|
54
|
+
runner = {}
|
55
|
+
runner[:jasmine_url] = options.url
|
56
|
+
runner[:phantomjs_bin] = options.bin
|
57
|
+
runner[:timeout] = options.timeout
|
58
|
+
runner[:console] = [:always, :never, :failure].include?(options.console.to_sym) ? options.console.to_sym : :failure
|
59
|
+
|
60
|
+
runner[:notification] = false
|
61
|
+
runner[:hide_success] = true
|
62
|
+
runner[:max_error_notify] = 0
|
63
|
+
runner[:specdoc] = :always
|
64
|
+
|
65
|
+
result = ::Guard::Jasmine::Runner.run(paths, runner)
|
66
|
+
Kernel.exit (result.first ? 0 : 1)
|
67
|
+
|
68
|
+
rescue Exception => e
|
69
|
+
::Guard::UI.error e.message
|
70
|
+
end
|
71
|
+
|
72
|
+
desc 'version', 'Show the Guard::Jasmine version'
|
73
|
+
map %w(-v --version) => :version
|
74
|
+
|
75
|
+
# Shows the current version of Guard::Jasmine.
|
76
|
+
#
|
77
|
+
# @see Guard::Jasmine::VERSION
|
78
|
+
#
|
79
|
+
def version
|
80
|
+
::Guard::UI.info "Guard::Jasmine version #{ ::Guard::JasmineVersion }"
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-jasmine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 63
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 8
|
9
|
+
- 0
|
10
|
+
version: 0.8.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Michael Kessler
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-10-
|
18
|
+
date: 2011-10-31 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: guard
|
@@ -66,9 +66,25 @@ dependencies:
|
|
66
66
|
type: :runtime
|
67
67
|
version_requirements: *id003
|
68
68
|
- !ruby/object:Gem::Dependency
|
69
|
-
name:
|
69
|
+
name: thor
|
70
70
|
prerelease: false
|
71
71
|
requirement: &id004 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ~>
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
hash: 43
|
77
|
+
segments:
|
78
|
+
- 0
|
79
|
+
- 14
|
80
|
+
- 6
|
81
|
+
version: 0.14.6
|
82
|
+
type: :runtime
|
83
|
+
version_requirements: *id004
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: bundler
|
86
|
+
prerelease: false
|
87
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
72
88
|
none: false
|
73
89
|
requirements:
|
74
90
|
- - ~>
|
@@ -79,11 +95,11 @@ dependencies:
|
|
79
95
|
- 0
|
80
96
|
version: "1.0"
|
81
97
|
type: :development
|
82
|
-
version_requirements: *
|
98
|
+
version_requirements: *id005
|
83
99
|
- !ruby/object:Gem::Dependency
|
84
100
|
name: guard-rspec
|
85
101
|
prerelease: false
|
86
|
-
requirement: &
|
102
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
87
103
|
none: false
|
88
104
|
requirements:
|
89
105
|
- - ~>
|
@@ -94,11 +110,11 @@ dependencies:
|
|
94
110
|
- 5
|
95
111
|
version: "0.5"
|
96
112
|
type: :development
|
97
|
-
version_requirements: *
|
113
|
+
version_requirements: *id006
|
98
114
|
- !ruby/object:Gem::Dependency
|
99
115
|
name: rspec
|
100
116
|
prerelease: false
|
101
|
-
requirement: &
|
117
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
102
118
|
none: false
|
103
119
|
requirements:
|
104
120
|
- - ~>
|
@@ -109,11 +125,11 @@ dependencies:
|
|
109
125
|
- 7
|
110
126
|
version: "2.7"
|
111
127
|
type: :development
|
112
|
-
version_requirements: *
|
128
|
+
version_requirements: *id007
|
113
129
|
- !ruby/object:Gem::Dependency
|
114
130
|
name: yard
|
115
131
|
prerelease: false
|
116
|
-
requirement: &
|
132
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
117
133
|
none: false
|
118
134
|
requirements:
|
119
135
|
- - ~>
|
@@ -125,27 +141,27 @@ dependencies:
|
|
125
141
|
- 3
|
126
142
|
version: 0.7.3
|
127
143
|
type: :development
|
128
|
-
version_requirements: *
|
144
|
+
version_requirements: *id008
|
129
145
|
- !ruby/object:Gem::Dependency
|
130
|
-
name:
|
146
|
+
name: redcarpet
|
131
147
|
prerelease: false
|
132
|
-
requirement: &
|
148
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
133
149
|
none: false
|
134
150
|
requirements:
|
135
151
|
- - ~>
|
136
152
|
- !ruby/object:Gem::Version
|
137
|
-
hash:
|
153
|
+
hash: 87
|
138
154
|
segments:
|
139
|
-
-
|
140
|
-
-
|
141
|
-
-
|
142
|
-
version:
|
155
|
+
- 1
|
156
|
+
- 17
|
157
|
+
- 2
|
158
|
+
version: 1.17.2
|
143
159
|
type: :development
|
144
|
-
version_requirements: *
|
160
|
+
version_requirements: *id009
|
145
161
|
- !ruby/object:Gem::Dependency
|
146
162
|
name: pry
|
147
163
|
prerelease: false
|
148
|
-
requirement: &
|
164
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
149
165
|
none: false
|
150
166
|
requirements:
|
151
167
|
- - ~>
|
@@ -158,18 +174,21 @@ dependencies:
|
|
158
174
|
- 2
|
159
175
|
version: 0.9.6.2
|
160
176
|
type: :development
|
161
|
-
version_requirements: *
|
177
|
+
version_requirements: *id010
|
162
178
|
description: Guard::Jasmine automatically tests your Jasmine specs on PhantomJS
|
163
179
|
email:
|
164
180
|
- michi@netzpiraten.ch
|
165
181
|
executables:
|
166
182
|
- guard-jasmine
|
183
|
+
- guard-jasmine-debug
|
167
184
|
extensions: []
|
168
185
|
|
169
186
|
extra_rdoc_files: []
|
170
187
|
|
171
188
|
files:
|
172
189
|
- bin/guard-jasmine
|
190
|
+
- bin/guard-jasmine-debug
|
191
|
+
- lib/guard/jasmine/cli.rb
|
173
192
|
- lib/guard/jasmine/formatter.rb
|
174
193
|
- lib/guard/jasmine/inspector.rb
|
175
194
|
- lib/guard/jasmine/phantomjs/run-jasmine.coffee
|