rabbitt-githooks 1.6.0 → 1.6.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3fc9f2e2715c624c84800b1e4acce192ec17d659
4
- data.tar.gz: 82068a8270deeb4810e2c4f32b3f5748e9352423
3
+ metadata.gz: 0c6ee6c892f449e7194836f8c009b2fcdb1f1a54
4
+ data.tar.gz: b5fd9f630b3915b742da75af5d4d089ecb2081f9
5
5
  SHA512:
6
- metadata.gz: 665c5935ad4362aafd8ec3800dd04a0d0aeda3c030e12679a93067355c1009a5980b088ffe5593012c631094204fb22cb4d74012e5e0f71d4cc33e6a861bd31b
7
- data.tar.gz: bc720d2df0b87b5ec92b3e5478a952bb3aa7b10f498f8607ddd987ee79642cad45c92707119d70bf1211797df5ae6025c0941097b410ed063890ff03ef9ea44e
6
+ metadata.gz: db9796de78bc0e72c8d4de6065330198fb059cd382ecfd8e293b2257450fa4e77a3e5458eef82643be711d119d306d6ba6dea2c3c3863b598b20407f8978cc1f
7
+ data.tar.gz: 242e272466bf37fff2edffb96e185d08b4da9be3d5c0cd6f955a58bb86596961336d5ccf2b049c41805eef02324ab013919c107364444fae6b4e255a01f37c3f
data/Gemfile CHANGED
@@ -19,3 +19,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
19
19
  source "http://rubygems.org"
20
20
 
21
21
  gemspec
22
+
23
+ if RUBY_ENGINE == 'ruby'
24
+ gem 'parser', "~> #{RUBY_VERSION}.0"
25
+ end
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rabbitt-githooks (1.6.0)
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)
@@ -23,7 +23,7 @@ require_relative 'repository'
23
23
 
24
24
  module GitHooks
25
25
  class Action
26
- attr_reader :title, :section, :on, :limiters
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(section.limiters.merge(@limiters))
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, @only).tap do |result|
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, match_value)
65
+ def match_file(file)
66
66
  if @inverted
67
- [*match_value].none? { |value| file.match(@type, value) }
67
+ Array(@only).none? { |value| file.match(@type, value) }
68
68
  else
69
- [*match_value].any? { |value| file.match(@type, value) }
69
+ Array(@only).any? { |value| file.match(@type, value) }
70
70
  end
71
71
  end
72
72
  end
@@ -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 " %3d: %s\n", section_index + 1, section.title
161
+ printf " %d: %s\n", section_index + 1, section.title
156
162
  section.actions.each_with_index do |action, action_index|
157
- printf " %3d: %s\n", action_index + 1, action.title
158
- action.limiters.each_with_index do |limiter, limiter_index|
159
- type, value = limiter.type.inspect, limiter.only
160
- value = value.first if value.size == 1
161
- printf " Limiter %d: %s -> %s\n", limiter_index + 1, type, value.inspect
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
@@ -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, :limiters
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 = hook.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
@@ -18,5 +18,5 @@ with this program; if not, write to the Free Software Foundation, Inc.,
18
18
  =end
19
19
 
20
20
  module GitHooks
21
- VERSION = '1.6.0' unless defined? VERSION
21
+ VERSION = '1.6.1' unless defined? VERSION
22
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rabbitt-githooks
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carl P. Corliss