guard-rspec 0.4.1 → 0.4.2

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
@@ -4,7 +4,7 @@ Guard::RSpec ![travis-ci](http://travis-ci.org/guard/guard-rspec.png)
4
4
  RSpec guard allows to automatically & intelligently launch specs when files are modified.
5
5
 
6
6
  * Compatible with RSpec 1.x & RSpec 2.x (>= 2.4 needed for the notification feature)
7
- * Tested on Ruby 1.8.7, 1.9.2, JRuby & Rubinius.
7
+ * Tested against Ruby 1.8.7, 1.9.2, REE, JRuby & Rubinius.
8
8
 
9
9
  Install
10
10
  -------
@@ -39,9 +39,9 @@ RSpec guard can be really adapted to all kind of projects.
39
39
 
40
40
  ``` ruby
41
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" }
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
45
  end
46
46
  ```
47
47
 
@@ -49,13 +49,13 @@ end
49
49
 
50
50
  ``` ruby
51
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"] }
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
59
  end
60
60
  ```
61
61
 
@@ -80,6 +80,14 @@ guard 'rspec', :cli => "--color --format nested --fail-fast --drb" do
80
80
  end
81
81
  ```
82
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
+
83
91
  Former `:color`, `:drb`, `:fail_fast` and `:formatter` options are thus deprecated and have no effect anymore.
84
92
 
85
93
  ### List of available options:
@@ -94,6 +102,7 @@ Former `:color`, `:drb`, `:fail_fast` and `:formatter` options are thus deprecat
94
102
  :all_on_start => false # don't run all the specs at startup, default: true
95
103
  :keep_failed => false # keep failed specs until them pass, default: true
96
104
  :run_all => { :cli => "-p" } # override any option when running all specs
105
+ :spec_paths => ["spec/"] # specify an array of paths that contain spec files
97
106
  ```
98
107
 
99
108
  Notification
@@ -144,5 +153,4 @@ Please run `rake spec:prepare_fixtures` once before launching specs.
144
153
  Author
145
154
  ------
146
155
 
147
- [Thibaud Guillaume-Gentil](https://github.com/thibaudgg)
148
-
156
+ [Thibaud Guillaume-Gentil](https://github.com/thibaudgg)
data/lib/guard/rspec.rb CHANGED
@@ -11,13 +11,15 @@ module Guard
11
11
  @options = {
12
12
  :all_after_pass => true,
13
13
  :all_on_start => true,
14
- :keep_failed => true
14
+ :keep_failed => true,
15
+ :spec_paths => ["spec/"]
15
16
  }.update(options)
16
17
  @last_failed = false
17
18
  @failed_paths = []
18
19
 
19
20
  Runner.set_rspec_version(options)
20
- Inspector.excluded = options[:exclude]
21
+ Inspector.excluded = @options[:exclude]
22
+ Inspector.spec_paths = @options[:spec_paths]
21
23
  end
22
24
 
23
25
  # Call once when guard starts
@@ -27,7 +29,7 @@ module Guard
27
29
  end
28
30
 
29
31
  def run_all
30
- passed = Runner.run(["spec/"], options.merge(options[:run_all] || {}).merge(:message => "Running all specs"))
32
+ passed = Runner.run(options[:spec_paths], options.merge(options[:run_all] || {}).merge(:message => "Running all specs"))
31
33
 
32
34
  @failed_paths = [] if passed
33
35
  @last_failed = !passed
@@ -9,6 +9,14 @@ module Guard
9
9
  def excluded=(glob)
10
10
  @excluded = Dir[glob.to_s]
11
11
  end
12
+
13
+ def spec_paths
14
+ @spec_paths || []
15
+ end
16
+
17
+ def spec_paths=(path_array)
18
+ @spec_paths = path_array
19
+ end
12
20
 
13
21
  def clean(paths)
14
22
  paths.uniq!
@@ -30,11 +38,12 @@ module Guard
30
38
  end
31
39
 
32
40
  def spec_folder?(path)
33
- path.match(%r{^spec[^\.]*$})
41
+ path.match(%r{^(#{spec_paths.join("|")})[^\.]*$})
42
+ # path.match(%r{^spec[^\.]*$})
34
43
  end
35
44
 
36
45
  def spec_files
37
- @spec_files ||= Dir["spec/**/*_spec.rb"]
46
+ @spec_files ||= spec_paths.collect { |path| Dir[File.join(path, "**", "*_spec.rb")] }.flatten
38
47
  end
39
48
 
40
49
  def clear_spec_files_list_after
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  module RSpecVersion
3
- VERSION = "0.4.1"
3
+ VERSION = "0.4.2"
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.1
4
+ version: 0.4.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-08-10 00:00:00.000000000Z
12
+ date: 2011-08-15 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: guard
16
- requirement: &70328300041900 !ruby/object:Gem::Requirement
16
+ requirement: &70211257686060 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.4.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70328300041900
24
+ version_requirements: *70211257686060
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: bundler
27
- requirement: &70328300041340 !ruby/object:Gem::Requirement
27
+ requirement: &70211257685480 !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: *70328300041340
35
+ version_requirements: *70211257685480
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &70328300040300 !ruby/object:Gem::Requirement
38
+ requirement: &70211257684920 !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: *70328300040300
46
+ version_requirements: *70211257684920
47
47
  description: Guard::RSpec automatically run your specs (much like autotest).
48
48
  email:
49
49
  - thibaud@thibaud.me