spectator 1.3.2 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +19 -2
- data/bin/spectator +13 -5
- data/lib/spectator/path_watcher.rb +5 -0
- data/lib/spectator/specs_matcher.rb +11 -4
- data/lib/spectator/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6693d10d070fcf32a20f5b6a898c8b55708e86eb
|
4
|
+
data.tar.gz: 9c6919feff85c5f37b0c5c4e7aaaedf7829436b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a592b163a872d7a0a6cdf21bd71094fdaf0987bf20b1254d2ea70c82776968ae6588174af27a20aa9594c0c519fe2a95d9ec36fed116697139a5e48f386ae12a
|
7
|
+
data.tar.gz: 3966c15c7512642b2cb6b637b42356a849bc28327c4e5a65921db1459e3e14990e264cb0ff9bc31378c24802926b05d97bd946d5297f68a778b92ff63a0664cb
|
data/README.md
CHANGED
@@ -34,7 +34,7 @@ Type `q` and `ENTER` (or `CTRL+C` again) to quit.
|
|
34
34
|
Type `a` and `ENTER` (or `CTRL+C` again) to execute the whole suite of specs.
|
35
35
|
|
36
36
|
|
37
|
-
## Advanced
|
37
|
+
## Advanced Configuration
|
38
38
|
|
39
39
|
If you want to override some path matching:
|
40
40
|
|
@@ -93,7 +93,24 @@ SPEC_DIR_REGEXP: 'spec/cli'
|
|
93
93
|
|
94
94
|
spectator .my-spectator-config
|
95
95
|
|
96
|
+
#### With a `.spectator.rb` script file
|
97
|
+
|
98
|
+
```ruby
|
99
|
+
# contents of ".spectator.rb" file
|
100
|
+
module Spectator
|
101
|
+
class SuccessNotifier
|
102
|
+
def notify(success)
|
103
|
+
fork { `say #{say_message(success)}`}
|
104
|
+
end
|
105
|
+
|
106
|
+
def say_message(success)
|
107
|
+
success ? 'All right' : 'Ouch'
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
```
|
112
|
+
|
96
113
|
|
97
114
|
## License
|
98
115
|
|
99
|
-
Copyright © 2011-
|
116
|
+
Copyright © 2011-2014 Elia Schito, released under the [MIT license](https://github.com/elia/spectator/blob/master/MIT-LICENSE)
|
data/bin/spectator
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# coding: utf-8
|
3
3
|
|
4
|
-
usage = "Usage: spectator [yaml-config]"
|
4
|
+
usage = "Usage: spectator [yaml-config|ruby-script-file|...]"
|
5
5
|
case ARGV.first
|
6
6
|
when '-h'
|
7
7
|
puts usage
|
@@ -20,10 +20,18 @@ end
|
|
20
20
|
require 'spectator'
|
21
21
|
|
22
22
|
require 'yaml'
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
|
24
|
+
config_files = ARGV.empty? ? %w[.spectator .spectator.rb] : ARGV
|
25
|
+
|
26
|
+
config_files.each do |config_file|
|
27
|
+
if config_file.end_with?('.rb')
|
28
|
+
load config_file if File.exist? config_file
|
29
|
+
else
|
30
|
+
YAML.load_file(config_file).each do |name, value|
|
31
|
+
ENV[name] ||= value
|
32
|
+
end if File.exist? config_file
|
33
|
+
end
|
34
|
+
end
|
27
35
|
|
28
36
|
config = Spectator.config(debug: ARGV.include?('--debug'))
|
29
37
|
Spectator.run(config)
|
@@ -39,6 +39,11 @@ module Spectator
|
|
39
39
|
listener = listener.filter %r{^(#{config.base_dir_regexp}|#{config.spec_dir_regexp})/}
|
40
40
|
listener = listener.change do |modified, added, removed|
|
41
41
|
p ['modified, added, removed', modified, added, removed]
|
42
|
+
|
43
|
+
if added.any? or removed.any?
|
44
|
+
Spectator::SpecsMatcher.reset_matchable_spec_files!
|
45
|
+
end
|
46
|
+
|
42
47
|
files = [modified, added].flatten
|
43
48
|
files.each { |relative| queue.push relative }
|
44
49
|
p on_change
|
@@ -29,10 +29,17 @@ module Spectator
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def match_specs matchable_paths
|
32
|
-
matchable_paths.uniq.
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
matchable_paths.uniq.flat_map do |path|
|
33
|
+
all_matchable_spec_files.grep(/\b#{path}_spec\.rb$/)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def all_matchable_spec_files
|
38
|
+
@@all_matchable_spec_files ||= Dir['**/**'].grep(%r{^#{config.spec_dir_regexp}})
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.reset_matchable_spec_files!
|
42
|
+
@@all_matchable_spec_files = nil
|
36
43
|
end
|
37
44
|
|
38
45
|
attr_reader :config, :files
|
data/lib/spectator/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spectator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elia
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-12-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: listen
|
@@ -143,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
143
|
version: '0'
|
144
144
|
requirements: []
|
145
145
|
rubyforge_project: rspec-rails-watchr
|
146
|
-
rubygems_version: 2.
|
146
|
+
rubygems_version: 2.4.3
|
147
147
|
signing_key:
|
148
148
|
specification_version: 4
|
149
149
|
summary: Watches specs for a Ruby or Rails project
|
@@ -151,3 +151,4 @@ test_files:
|
|
151
151
|
- spec/spec_helper.rb
|
152
152
|
- spec/spectator/specs_matcher_spec.rb
|
153
153
|
- spec/spectator_spec.rb
|
154
|
+
has_rdoc:
|