githooker 0.2.10 → 0.2.11

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.10
1
+ 0.2.11
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "githooker"
8
- s.version = "0.2.10"
8
+ s.version = "0.2.11"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Carl P. Corliss"]
@@ -19,11 +19,13 @@ module GitHooker
19
19
  raise ArgumentError, "Missing required block to #register" unless block_given?
20
20
 
21
21
  @phase = (options.delete(:phase) || :any).to_s.to_sym
22
- unless GitHooker::VALID_PHASES.include? phase
22
+ unless GitHooker::VALID_PHASES.include? @phase
23
23
  raise ArgumentError, "Phase must be one of #{GitHooker::VALID_PHASES.join(', ')}"
24
24
  end
25
25
 
26
- instance_eval(&block) if Repo.match_phase(@phase)
26
+ if Repo.match_phase(@phase)
27
+ instance_eval(&block)
28
+ end
27
29
  self
28
30
  end
29
31
 
@@ -92,8 +92,7 @@ module GitHooker
92
92
  end
93
93
 
94
94
  def match_phase(phase = :any)
95
- return true if phase == :any
96
- return GitHooker::SCRIPT_NAME.to_sym == phase.to_s.to_sym
95
+ phase == :any || GitHooker::SCRIPT_NAME.to_sym == phase.to_s.to_sym
97
96
  end
98
97
 
99
98
  def match_file(file, matchtype, matchvalue)
@@ -8,7 +8,9 @@ module GitHooker
8
8
 
9
9
  success = Hook.run
10
10
 
11
- Hook.sections.each do |section|
11
+ Hook.sections.select {|section|
12
+ not section.actions.empty?
13
+ }.each do |section|
12
14
  hash_tail_length = (max_section_length - section.name.length)
13
15
  printf "===== %s %s=====\n", section.colored_name, ("=" * hash_tail_length)
14
16
 
@@ -16,10 +16,14 @@ module GitHooker
16
16
  end
17
17
 
18
18
  def actions
19
- @actions.collect { |action| Repo.match_phase(action.phase) }
19
+ @actions.select { |action|
20
+ Repo.match_phase(action.phase)
21
+ }
20
22
  end
21
23
  alias :__getobj__ :actions
22
24
 
25
+ def <<(action) @actions << action; end
26
+
23
27
  def stop_on_error?() @stop_on_error; end
24
28
 
25
29
  def success?() @success; end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: githooker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.10
4
+ version: 0.2.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: