guard-rspec 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/guard/rspec/inspector.rb +69 -61
- data/lib/guard/rspec/version.rb +1 -1
- metadata +9 -9
@@ -1,61 +1,69 @@
|
|
1
|
-
module Guard
|
2
|
-
class RSpec
|
3
|
-
module Inspector
|
4
|
-
class << self
|
5
|
-
def excluded
|
6
|
-
@excluded || []
|
7
|
-
end
|
8
|
-
|
9
|
-
def excluded=(glob)
|
10
|
-
@excluded = Dir[glob.to_s]
|
11
|
-
end
|
12
|
-
|
13
|
-
def spec_paths
|
14
|
-
@spec_paths || []
|
15
|
-
end
|
16
|
-
|
17
|
-
def spec_paths=(path_array)
|
18
|
-
@spec_paths = Array(path_array)
|
19
|
-
end
|
20
|
-
|
21
|
-
def clean(paths)
|
22
|
-
paths.uniq!
|
23
|
-
paths.compact!
|
24
|
-
clear_spec_files_list_after do
|
25
|
-
paths = paths.select { |path| should_run_spec_file?(path) }
|
26
|
-
end
|
27
|
-
paths.reject { |p| included_in_other_path?(p, paths) }
|
28
|
-
end
|
29
|
-
|
30
|
-
private
|
31
|
-
|
32
|
-
def should_run_spec_file?(path)
|
33
|
-
(spec_file?(path) || spec_folder?(path)) && !excluded.include?(path)
|
34
|
-
end
|
35
|
-
|
36
|
-
def spec_file?(path)
|
37
|
-
spec_files.include?(path)
|
38
|
-
end
|
39
|
-
|
40
|
-
def
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
end
|
48
|
-
|
49
|
-
def
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
1
|
+
module Guard
|
2
|
+
class RSpec
|
3
|
+
module Inspector
|
4
|
+
class << self
|
5
|
+
def excluded
|
6
|
+
@excluded || []
|
7
|
+
end
|
8
|
+
|
9
|
+
def excluded=(glob)
|
10
|
+
@excluded = Dir[glob.to_s]
|
11
|
+
end
|
12
|
+
|
13
|
+
def spec_paths
|
14
|
+
@spec_paths || []
|
15
|
+
end
|
16
|
+
|
17
|
+
def spec_paths=(path_array)
|
18
|
+
@spec_paths = Array(path_array)
|
19
|
+
end
|
20
|
+
|
21
|
+
def clean(paths)
|
22
|
+
paths.uniq!
|
23
|
+
paths.compact!
|
24
|
+
clear_spec_files_list_after do
|
25
|
+
paths = paths.select { |path| should_run_spec_file?(path) }
|
26
|
+
end
|
27
|
+
paths.reject { |p| included_in_other_path?(p, paths) }
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def should_run_spec_file?(path)
|
33
|
+
(spec_file?(path) || feature_file?(path) || spec_folder?(path)) && !excluded.include?(path)
|
34
|
+
end
|
35
|
+
|
36
|
+
def spec_file?(path)
|
37
|
+
spec_files.include?(path)
|
38
|
+
end
|
39
|
+
|
40
|
+
def feature_file?(path)
|
41
|
+
feature_files.include?(path)
|
42
|
+
end
|
43
|
+
|
44
|
+
def spec_folder?(path)
|
45
|
+
path.match(%r{^(#{spec_paths.join("|")})[^\.]*$})
|
46
|
+
# path.match(%r{^spec[^\.]*$})
|
47
|
+
end
|
48
|
+
|
49
|
+
def spec_files
|
50
|
+
@spec_files ||= spec_paths.collect { |path| Dir[File.join(path, "**", "*_spec.rb")] }.flatten
|
51
|
+
end
|
52
|
+
|
53
|
+
def feature_files
|
54
|
+
@feature_files ||= spec_paths.collect { |path| Dir[File.join(path, "**", "*.feature")] }.flatten
|
55
|
+
end
|
56
|
+
|
57
|
+
def clear_spec_files_list_after
|
58
|
+
yield
|
59
|
+
@spec_files = nil
|
60
|
+
end
|
61
|
+
|
62
|
+
def included_in_other_path?(path, paths)
|
63
|
+
(paths - [path]).any? { |p| path.include?(p) && path.sub(p, '').include?('/') }
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
data/lib/guard/rspec/version.rb
CHANGED
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.5.
|
4
|
+
version: 0.5.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-
|
12
|
+
date: 2011-11-03 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: guard
|
16
|
-
requirement: &
|
16
|
+
requirement: &70330372160140 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.8.4
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70330372160140
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: bundler
|
27
|
-
requirement: &
|
27
|
+
requirement: &70330372159640 !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: *
|
35
|
+
version_requirements: *70330372159640
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &70330372159180 !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: *
|
46
|
+
version_requirements: *70330372159180
|
47
47
|
description: Guard::RSpec automatically run your specs (much like autotest).
|
48
48
|
email:
|
49
49
|
- thibaud@thibaud.me
|
@@ -75,7 +75,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
75
75
|
version: '0'
|
76
76
|
segments:
|
77
77
|
- 0
|
78
|
-
hash:
|
78
|
+
hash: 1372171811730105322
|
79
79
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
80
|
none: false
|
81
81
|
requirements:
|