spectator 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/spectator.rb +14 -10
  2. data/lib/spectator/version.rb +1 -1
  3. metadata +12 -12
data/lib/spectator.rb CHANGED
@@ -28,9 +28,9 @@ module Spectator
28
28
 
29
29
  def watch_paths!
30
30
  FSSM.monitor(Dir.pwd, '{app,spec,lib,script}/**/*') do |monitor|
31
- monitor.update {|base, relative| puts relative; queue.push relative }
32
- monitor.create {|base, relative| puts relative; queue.push relative }
33
- monitor.delete {|base, relative| puts relative; '''do nothing''' }
31
+ monitor.update {|base, relative| queue.push relative }
32
+ monitor.create {|base, relative| queue.push relative }
33
+ monitor.delete {|base, relative| '''do nothing''' }
34
34
  end
35
35
  end
36
36
 
@@ -58,16 +58,19 @@ module Spectator
58
58
  queue.size.times do
59
59
  files << queue.pop
60
60
  end
61
-
61
+
62
+ files.compact!
63
+ redo if files.empty?
64
+
65
+
62
66
  specs = Set.new
63
67
  files.each do |file|
64
- specs += matchers.map do |matcher|
65
- file_signature = $1.gsub(/\.rb$/,'') if matcher =~ file
66
- specs_for file
67
- end.flatten
68
+ matched = matchers.map do |matcher|
69
+ file.scan(matcher).flatten.first.to_s.gsub(/\.rb$/,'')
70
+ end.flatten.reject(&:empty?)
71
+ specs += matched.uniq.map { |m| specs_for(m) }.flatten
68
72
  end
69
-
70
- rspec_files specs.to_a
73
+ rspec_files *specs.to_a
71
74
  end
72
75
  end
73
76
 
@@ -79,6 +82,7 @@ module Spectator
79
82
  matchers << %r{^(?:app|lib|script)/(.*)(?:\.rb|\.\w+|)$}
80
83
 
81
84
  trap_int!
85
+ Thread.abort_on_exception = true
82
86
  @runner = Thread.new { wait_for_changes }
83
87
  watch_paths!
84
88
  end
@@ -1,3 +1,3 @@
1
1
  module Spectator
2
- VERSION = '1.2.1'
2
+ VERSION = '1.2.2'
3
3
  end
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.2.1
4
+ version: 1.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-03-23 00:00:00.000000000 Z
13
+ date: 2012-03-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: fssm
17
- requirement: &70146497655500 !ruby/object:Gem::Requirement
17
+ requirement: &70138721693160 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70146497655500
25
+ version_requirements: *70138721693160
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: term-ansicolor
28
- requirement: &70146497655080 !ruby/object:Gem::Requirement
28
+ requirement: &70138721692440 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *70146497655080
36
+ version_requirements: *70138721692440
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: notify
39
- requirement: &70146497654660 !ruby/object:Gem::Requirement
39
+ requirement: &70138721691800 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: '0'
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *70146497654660
47
+ version_requirements: *70138721691800
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: rake
50
- requirement: &70146497654120 !ruby/object:Gem::Requirement
50
+ requirement: &70138721691140 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ~>
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: '0.9'
56
56
  type: :development
57
57
  prerelease: false
58
- version_requirements: *70146497654120
58
+ version_requirements: *70138721691140
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: bundler
61
- requirement: &70146497653600 !ruby/object:Gem::Requirement
61
+ requirement: &70138721690460 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ~>
@@ -66,7 +66,7 @@ dependencies:
66
66
  version: '1.0'
67
67
  type: :development
68
68
  prerelease: false
69
- version_requirements: *70146497653600
69
+ version_requirements: *70138721690460
70
70
  description: Watches specs for a Ruby (1.8 or 1.9) or Rails (2 or 3) project
71
71
  email:
72
72
  - elia@schito.me