guard-rspec 0.4.5 → 0.5.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 CHANGED
@@ -1,183 +1,183 @@
1
- Guard::RSpec ![travis-ci](http://travis-ci.org/guard/guard-rspec.png)
2
- =============
3
-
4
- RSpec guard allows to automatically & intelligently launch specs when files are modified.
5
-
6
- * Compatible with RSpec 1.x & RSpec 2.x (>= 2.4 needed for the notification feature)
7
- * Tested against Ruby 1.8.7, 1.9.2, REE, JRuby & Rubinius.
8
-
9
- Install
10
- -------
11
-
12
- Please be sure to have [Guard](https://github.com/guard/guard) installed before continue.
13
-
14
- Install the gem:
15
-
16
- $ gem install guard-rspec
17
-
18
- Add it to your Gemfile (inside development group):
19
-
20
- ``` ruby
21
- gem 'guard-rspec'
22
- ```
23
-
24
- Add guard definition to your Guardfile by running this command:
25
-
26
- $ guard init rspec
27
-
28
- Usage
29
- -----
30
-
31
- Please read [Guard usage doc](https://github.com/guard/guard#readme)
32
-
33
- Guardfile
34
- ---------
35
-
36
- RSpec guard can be really adapted to all kind of projects.
37
-
38
- ### Standard RubyGem project
39
-
40
- ``` ruby
41
- guard 'rspec' do
42
- watch(%r{^spec/.+_spec\.rb$})
43
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
44
- watch('spec/spec_helper.rb') { "spec" }
45
- end
46
- ```
47
-
48
- ### Typical Rails app
49
-
50
- ``` ruby
51
- guard 'rspec' do
52
- watch('spec/spec_helper.rb') { "spec" }
53
- watch('config/routes.rb') { "spec/routing" }
54
- watch('app/controllers/application_controller.rb') { "spec/controllers" }
55
- watch(%r{^spec/.+_spec\.rb$})
56
- watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
57
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
58
- watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
59
- end
60
- ```
61
-
62
- Please read [Guard doc](https://github.com/guard/guard#readme) for more information about the Guardfile DSL.
63
-
64
- Options
65
- -------
66
-
67
- By default, Guard::RSpec automatically detect your RSpec version (with the `spec_helper.rb` syntax or with Bundler) but you can force the version with the `:version` option:
68
-
69
- ``` ruby
70
- guard 'rspec', :version => 2 do
71
- # ...
72
- end
73
- ```
74
-
75
- You can pass any of the standard RSpec CLI options using the `:cli` option:
76
-
77
- ``` ruby
78
- guard 'rspec', :cli => "--color --format nested --fail-fast --drb" do
79
- # ...
80
- end
81
- ```
82
-
83
- By default, Guard::RSpec will only look for spec files within `spec` in your project root. You can configure Guard::RSpec to look in additional paths by using the `:spec_paths` option:
84
-
85
- ``` ruby
86
- guard 'rspec', :spec_paths => ["spec", "vendor/engines/reset/spec"] do
87
- # ...
88
- end
89
- ```
90
- If you have only one path to look, you can configure `:spec_paths` option with a string:
91
-
92
- ``` ruby
93
- guard 'rspec', :spec_paths => "test" do
94
- # ...
95
- end
96
- ```
97
-
98
-
99
- Former `:color`, `:drb`, `:fail_fast` and `:formatter` options are thus deprecated and have no effect anymore.
100
-
101
- ### List of available options:
102
-
103
- ``` ruby
104
- :version => 1 # force use RSpec version 1, default: 2
105
- :cli => "-c -f doc" # pass arbitrary RSpec CLI arguments, default: "-f progress"
106
- :bundler => false # don't use "bundle exec" to run the RSpec command, default: true
107
- :rvm => ['1.8.7', '1.9.2'] # directly run your specs on multiple Rubies, default: nil
108
- :notification => false # don't display Growl (or Libnotify) notification after the specs are done running, default: true
109
- :all_after_pass => false # don't run all specs after changed specs pass, default: true
110
- :all_on_start => false # don't run all the specs at startup, default: true
111
- :keep_failed => false # don't keep failed specs until they pass, default: true
112
- :run_all => { :cli => "-p" } # override any option when running all specs
113
- :spec_paths => ["spec"] # specify an array of paths that contain spec files
114
- ```
115
-
116
- Notification
117
- ------------
118
-
119
- The notification feature is only available for RSpec < 2, and RSpec >= 2.4 (due to the multiple-formatters feature that was present in RSpec 1, was removed in RSpec 2 and reintroduced in RSpec 2.4). So if you are using a version between 2 and 2.4, you should disable the notification with <tt>:notification => false</tt>. Otherwise, nothing will be displayed in the terminal when your specs will run.
120
-
121
- The best solution is still to update RSpec to the latest version!
122
-
123
- Formatters
124
- ----------
125
-
126
- The `:formatter` option has been removed since CLI arguments can be passed through the `:cli` option. If you want to use the former Instafail formatter, you need to use [rspec-instafail](http://rubygems.org/gems/rspec-instafail) gem instead:
127
-
128
- ``` ruby
129
- # in your Gemfile
130
- gem 'rspec-instafail'
131
-
132
- # in your Guardfile
133
- guard 'rspec', :cli => '-r rspec/instafail -f RSpec::Instafail' do
134
- # ...
135
- end
136
- ```
137
-
138
- Default formatter is the `progress` formatter (same as RSpec default).
139
-
140
- Running a subset of all specs
141
- -----------
142
-
143
- The `:all_on_start` and `:all_after_pass` options cause all specs located in the `spec` directory to be run. If there
144
- are some specs you want to skip, you can tag them with RSpec metadata (such as `:slow => true`)
145
- and skip them with the cli `--tag` option (i.e. `--tag ~slow`).
146
-
147
- You can also use option :spec_paths to override paths used when running all specs.
148
- You can use this feature to create multiple groups of guarded specs with distinct paths, and execute each in own process:
149
-
150
- ``` ruby
151
- # in your Guardfile
152
- group 'acceptance-tests' do
153
- guard 'rspec', :spec_paths => ['spec/acceptance'] do
154
- # ...
155
- end
156
- end
157
-
158
- group 'unit-tests' do
159
- guard 'rspec', :spec_paths => ['spec/models', 'spec/controllers', 'spec/routing'] do
160
- # ...
161
- end
162
- end
163
- ```
164
-
165
-
166
- Development
167
- -----------
168
-
169
- * Source hosted at [GitHub](https://github.com/guard/guard-rspec)
170
- * Report issues/Questions/Feature requests on [GitHub Issues](https://github.com/guard/guard-rspec/issues)
171
-
172
- Pull requests are very welcome! Make sure your patches are well tested. Please create a topic branch for every separate change
173
- you make.
174
-
175
- Testing
176
- -------
177
-
178
- Please run `rake spec:prepare_fixtures` once before launching specs.
179
-
180
- Author
181
- ------
182
-
183
- [Thibaud Guillaume-Gentil](https://github.com/thibaudgg)
1
+ Guard::RSpec ![travis-ci](http://travis-ci.org/guard/guard-rspec.png)
2
+ =============
3
+
4
+ RSpec guard allows to automatically & intelligently launch specs when files are modified.
5
+
6
+ * Compatible with RSpec 1.x & RSpec 2.x (>= 2.4 needed for the notification feature)
7
+ * Tested against Ruby 1.8.7, 1.9.2, REE, JRuby & Rubinius.
8
+
9
+ Install
10
+ -------
11
+
12
+ Please be sure to have [Guard](https://github.com/guard/guard) installed before continue.
13
+
14
+ Install the gem:
15
+
16
+ $ gem install guard-rspec
17
+
18
+ Add it to your Gemfile (inside development group):
19
+
20
+ ``` ruby
21
+ gem 'guard-rspec'
22
+ ```
23
+
24
+ Add guard definition to your Guardfile by running this command:
25
+
26
+ $ guard init rspec
27
+
28
+ Usage
29
+ -----
30
+
31
+ Please read [Guard usage doc](https://github.com/guard/guard#readme)
32
+
33
+ Guardfile
34
+ ---------
35
+
36
+ RSpec guard can be really adapted to all kind of projects.
37
+
38
+ ### Standard RubyGem project
39
+
40
+ ``` ruby
41
+ guard 'rspec' do
42
+ watch(%r{^spec/.+_spec\.rb$})
43
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
44
+ watch('spec/spec_helper.rb') { "spec" }
45
+ end
46
+ ```
47
+
48
+ ### Typical Rails app
49
+
50
+ ``` ruby
51
+ guard 'rspec' do
52
+ watch('spec/spec_helper.rb') { "spec" }
53
+ watch('config/routes.rb') { "spec/routing" }
54
+ watch('app/controllers/application_controller.rb') { "spec/controllers" }
55
+ watch(%r{^spec/.+_spec\.rb$})
56
+ watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
57
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
58
+ watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
59
+ end
60
+ ```
61
+
62
+ Please read [Guard doc](https://github.com/guard/guard#readme) for more information about the Guardfile DSL.
63
+
64
+ Options
65
+ -------
66
+
67
+ By default, Guard::RSpec automatically detect your RSpec version (with the `spec_helper.rb` syntax or with Bundler) but you can force the version with the `:version` option:
68
+
69
+ ``` ruby
70
+ guard 'rspec', :version => 2 do
71
+ # ...
72
+ end
73
+ ```
74
+
75
+ You can pass any of the standard RSpec CLI options using the `:cli` option:
76
+
77
+ ``` ruby
78
+ guard 'rspec', :cli => "--color --format nested --fail-fast --drb" do
79
+ # ...
80
+ end
81
+ ```
82
+
83
+ By default, Guard::RSpec will only look for spec files within `spec` in your project root. You can configure Guard::RSpec to look in additional paths by using the `:spec_paths` option:
84
+
85
+ ``` ruby
86
+ guard 'rspec', :spec_paths => ["spec", "vendor/engines/reset/spec"] do
87
+ # ...
88
+ end
89
+ ```
90
+ If you have only one path to look, you can configure `:spec_paths` option with a string:
91
+
92
+ ``` ruby
93
+ guard 'rspec', :spec_paths => "test" do
94
+ # ...
95
+ end
96
+ ```
97
+
98
+
99
+ Former `:color`, `:drb`, `:fail_fast` and `:formatter` options are thus deprecated and have no effect anymore.
100
+
101
+ ### List of available options:
102
+
103
+ ``` ruby
104
+ :version => 1 # force use RSpec version 1, default: 2
105
+ :cli => "-c -f doc" # pass arbitrary RSpec CLI arguments, default: "-f progress"
106
+ :bundler => false # don't use "bundle exec" to run the RSpec command, default: true
107
+ :rvm => ['1.8.7', '1.9.2'] # directly run your specs on multiple Rubies, default: nil
108
+ :notification => false # display Growl (or Libnotify) notification after the specs are done running, default: true
109
+ :all_after_pass => false # run all specs after changed specs pass, default: true
110
+ :all_on_start => false # run all the specs at startup, default: true
111
+ :keep_failed => false # keep failed specs until they pass, default: true
112
+ :run_all => { :cli => "-p" } # override any option when running all specs
113
+ :spec_paths => ["spec"] # specify an array of paths that contain spec files
114
+ ```
115
+
116
+ Notification
117
+ ------------
118
+
119
+ The notification feature is only available for RSpec < 2, and RSpec >= 2.4 (due to the multiple-formatters feature that was present in RSpec 1, was removed in RSpec 2 and reintroduced in RSpec 2.4). So if you are using a version between 2 and 2.4, you should disable the notification with <tt>:notification => false</tt>. Otherwise, nothing will be displayed in the terminal when your specs will run.
120
+
121
+ The best solution is still to update RSpec to the latest version!
122
+
123
+ Formatters
124
+ ----------
125
+
126
+ The `:formatter` option has been removed since CLI arguments can be passed through the `:cli` option. If you want to use the former Instafail formatter, you need to use [rspec-instafail](http://rubygems.org/gems/rspec-instafail) gem instead:
127
+
128
+ ``` ruby
129
+ # in your Gemfile
130
+ gem 'rspec-instafail'
131
+
132
+ # in your Guardfile
133
+ guard 'rspec', :cli => '-r rspec/instafail -f RSpec::Instafail' do
134
+ # ...
135
+ end
136
+ ```
137
+
138
+ Default formatter is the `progress` formatter (same as RSpec default).
139
+
140
+ Running a subset of all specs
141
+ -----------
142
+
143
+ The `:all_on_start` and `:all_after_pass` options cause all specs located in the `spec` directory to be run. If there
144
+ are some specs you want to skip, you can tag them with RSpec metadata (such as `:slow => true`)
145
+ and skip them with the cli `--tag` option (i.e. `--tag ~slow`).
146
+
147
+ You can also use option :spec_paths to override paths used when running all specs.
148
+ You can use this feature to create multiple groups of guarded specs with distinct paths, and execute each in own process:
149
+
150
+ ``` ruby
151
+ # in your Guardfile
152
+ group 'acceptance-tests' do
153
+ guard 'rspec', :spec_paths => ['spec/acceptance'] do
154
+ # ...
155
+ end
156
+ end
157
+
158
+ group 'unit-tests' do
159
+ guard 'rspec', :spec_paths => ['spec/models', 'spec/controllers', 'spec/routing'] do
160
+ # ...
161
+ end
162
+ end
163
+ ```
164
+
165
+
166
+ Development
167
+ -----------
168
+
169
+ * Source hosted at [GitHub](https://github.com/guard/guard-rspec)
170
+ * Report issues/Questions/Feature requests on [GitHub Issues](https://github.com/guard/guard-rspec/issues)
171
+
172
+ Pull requests are very welcome! Make sure your patches are well tested. Please create a topic branch for every separate change
173
+ you make.
174
+
175
+ Testing
176
+ -------
177
+
178
+ Please run `rake spec:prepare_fixtures` once before launching specs.
179
+
180
+ Author
181
+ ------
182
+
183
+ [Thibaud Guillaume-Gentil](https://github.com/thibaudgg)
data/lib/guard/rspec.rb CHANGED
@@ -31,8 +31,12 @@ module Guard
31
31
  def run_all
32
32
  passed = Runner.run(options[:spec_paths], options.merge(options[:run_all] || {}).merge(:message => "Running all specs"))
33
33
 
34
- @failed_paths = [] if passed
35
- @last_failed = !passed
34
+ @last_failed = !passed
35
+ if passed
36
+ @failed_paths = []
37
+ else
38
+ throw :task_has_failed
39
+ end
36
40
  end
37
41
 
38
42
  def reload
@@ -54,6 +58,7 @@ module Guard
54
58
  @failed_paths += paths if @options[:keep_failed]
55
59
  # track whether the changed specs failed for the next change
56
60
  @last_failed = true
61
+ throw :task_has_failed
57
62
  end
58
63
  end
59
64
 
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  module RSpecVersion
3
- VERSION = "0.4.5"
3
+ VERSION = "0.5.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5
4
+ version: 0.5.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,22 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-11 00:00:00.000000000Z
12
+ date: 2011-10-08 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: guard
16
- requirement: &70173358142740 !ruby/object:Gem::Requirement
16
+ requirement: &70151341300420 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: 0.4.0
21
+ version: 0.8.4
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70173358142740
24
+ version_requirements: *70151341300420
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: bundler
27
- requirement: &70173358142020 !ruby/object:Gem::Requirement
27
+ requirement: &70151341299500 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '1.0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70173358142020
35
+ version_requirements: *70151341299500
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &70173358140980 !ruby/object:Gem::Requirement
38
+ requirement: &70151341298520 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '2.6'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70173358140980
46
+ version_requirements: *70151341298520
47
47
  description: Guard::RSpec automatically run your specs (much like autotest).
48
48
  email:
49
49
  - thibaud@thibaud.me