rabbitt-githooks 1.6.0 → 1.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +4 -0
- data/Gemfile.lock +2 -3
- data/lib/githooks/action.rb +6 -2
- data/lib/githooks/repository/limiter.rb +4 -4
- data/lib/githooks/runner.rb +15 -6
- data/lib/githooks/section.rb +6 -2
- data/lib/githooks/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c6ee6c892f449e7194836f8c009b2fcdb1f1a54
|
4
|
+
data.tar.gz: b5fd9f630b3915b742da75af5d4d089ecb2081f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db9796de78bc0e72c8d4de6065330198fb059cd382ecfd8e293b2257450fa4e77a3e5458eef82643be711d119d306d6ba6dea2c3c3863b598b20407f8978cc1f
|
7
|
+
data.tar.gz: 242e272466bf37fff2edffb96e185d08b4da9be3d5c0cd6f955a58bb86596961336d5ccf2b049c41805eef02324ab013919c107364444fae6b4e255a01f37c3f
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rabbitt-githooks (1.6.
|
4
|
+
rabbitt-githooks (1.6.1)
|
5
5
|
rainbow (~> 2.0.0)
|
6
6
|
thor (~> 0.19.1)
|
7
7
|
|
@@ -14,7 +14,6 @@ GEM
|
|
14
14
|
diff-lcs (1.2.5)
|
15
15
|
docile (1.1.5)
|
16
16
|
json (1.8.3)
|
17
|
-
json (1.8.3-java)
|
18
17
|
parser (2.2.2.6)
|
19
18
|
ast (>= 1.1, < 3.0)
|
20
19
|
powerpack (0.1.1)
|
@@ -48,11 +47,11 @@ GEM
|
|
48
47
|
yard (0.8.7.6)
|
49
48
|
|
50
49
|
PLATFORMS
|
51
|
-
java
|
52
50
|
ruby
|
53
51
|
|
54
52
|
DEPENDENCIES
|
55
53
|
bundler (~> 1.3)
|
54
|
+
parser (~> 2.2.2.0)
|
56
55
|
rabbitt-githooks!
|
57
56
|
rake (~> 10.1)
|
58
57
|
rspec (~> 2.14)
|
data/lib/githooks/action.rb
CHANGED
@@ -23,7 +23,7 @@ require_relative 'repository'
|
|
23
23
|
|
24
24
|
module GitHooks
|
25
25
|
class Action
|
26
|
-
attr_reader :title, :section, :on
|
26
|
+
attr_reader :title, :section, :on
|
27
27
|
attr_reader :success, :errors, :warnings, :benchmark
|
28
28
|
private :section, :on
|
29
29
|
alias_method :success?, :success
|
@@ -45,8 +45,12 @@ module GitHooks
|
|
45
45
|
waiting!
|
46
46
|
end
|
47
47
|
|
48
|
+
def limiters
|
49
|
+
section.limiters.merge(@limiters)
|
50
|
+
end
|
51
|
+
|
48
52
|
def manifest
|
49
|
-
@manifest ||= section.hook.manifest.filter(
|
53
|
+
@manifest ||= section.hook.manifest.filter(limiters)
|
50
54
|
end
|
51
55
|
|
52
56
|
def colored_title
|
@@ -47,7 +47,7 @@ module GitHooks
|
|
47
47
|
|
48
48
|
def limit(files)
|
49
49
|
files.select! do |file|
|
50
|
-
match_file(file
|
50
|
+
match_file(file).tap do |result|
|
51
51
|
if GitHooks.debug?
|
52
52
|
result = (result ? 'success' : 'failure')
|
53
53
|
STDERR.puts " #{file.path} (#{file.attribute_value(@type).inspect}) was a #{result}"
|
@@ -62,11 +62,11 @@ module GitHooks
|
|
62
62
|
@inverted = true
|
63
63
|
end
|
64
64
|
|
65
|
-
def match_file(file
|
65
|
+
def match_file(file)
|
66
66
|
if @inverted
|
67
|
-
|
67
|
+
Array(@only).none? { |value| file.match(@type, value) }
|
68
68
|
else
|
69
|
-
|
69
|
+
Array(@only).any? { |value| file.match(@type, value) }
|
70
70
|
end
|
71
71
|
end
|
72
72
|
end
|
data/lib/githooks/runner.rb
CHANGED
@@ -151,14 +151,23 @@ module GitHooks
|
|
151
151
|
next unless Hook.phases[phase]
|
152
152
|
|
153
153
|
puts " Phase #{phase.camelize}:"
|
154
|
+
|
155
|
+
Hook.phases[phase].limiters.each_with_index do |(type, limiter), limiter_index|
|
156
|
+
selector = limiter.only.size > 1 ? limiter.only : limiter.only.first
|
157
|
+
printf " Hook Limiter %d: %s -> %s\n", limiter_index + 1, type, selector.inspect
|
158
|
+
end
|
159
|
+
|
154
160
|
Hook.phases[phase].sections.each_with_index do |section, section_index|
|
155
|
-
printf " %
|
161
|
+
printf " %d: %s\n", section_index + 1, section.title
|
156
162
|
section.actions.each_with_index do |action, action_index|
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
163
|
+
section.limiters.each_with_index do |(type, limiter), limiter_index|
|
164
|
+
selector = limiter.only.size > 1 ? limiter.only : limiter.only.first
|
165
|
+
printf " Section Limiter %d: %s -> %s\n", limiter_index + 1, type, selector.inspect
|
166
|
+
end
|
167
|
+
printf " %d: %s\n", action_index + 1, action.title
|
168
|
+
action.limiters.each_with_index do |(type, limiter), limiter_index|
|
169
|
+
selector = limiter.only.size > 1 ? limiter.only : limiter.only.first
|
170
|
+
printf " Action Limiter %d: %s -> %s\n", limiter_index + 1, type, selector.inspect
|
162
171
|
end
|
163
172
|
end
|
164
173
|
end
|
data/lib/githooks/section.rb
CHANGED
@@ -21,7 +21,7 @@ require 'delegate'
|
|
21
21
|
|
22
22
|
module GitHooks
|
23
23
|
class Section < DelegateClass(Array)
|
24
|
-
attr_reader :name, :hook, :success, :benchmark
|
24
|
+
attr_reader :name, :hook, :success, :benchmark
|
25
25
|
|
26
26
|
alias_method :title, :name
|
27
27
|
alias_method :success?, :success
|
@@ -36,7 +36,7 @@ module GitHooks
|
|
36
36
|
@name = name.to_s.titleize
|
37
37
|
@success = true
|
38
38
|
@actions = []
|
39
|
-
@limiters =
|
39
|
+
@limiters = {}
|
40
40
|
@hook = hook
|
41
41
|
@benchmark = 0
|
42
42
|
|
@@ -45,6 +45,10 @@ module GitHooks
|
|
45
45
|
waiting!
|
46
46
|
end
|
47
47
|
|
48
|
+
def limiters
|
49
|
+
hook.limiters.merge(@limiters)
|
50
|
+
end
|
51
|
+
|
48
52
|
# overrides previous action method to only return
|
49
53
|
# actions that have a non-empty manifest
|
50
54
|
def actions
|
data/lib/githooks/version.rb
CHANGED