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 +1 -1
- data/githooker.gemspec +1 -1
- data/lib/githooker/hook.rb +4 -2
- data/lib/githooker/repo.rb +1 -2
- data/lib/githooker/runner.rb +3 -1
- data/lib/githooker/section.rb +5 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.11
|
data/githooker.gemspec
CHANGED
data/lib/githooker/hook.rb
CHANGED
@@ -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
|
-
|
26
|
+
if Repo.match_phase(@phase)
|
27
|
+
instance_eval(&block)
|
28
|
+
end
|
27
29
|
self
|
28
30
|
end
|
29
31
|
|
data/lib/githooker/repo.rb
CHANGED
@@ -92,8 +92,7 @@ module GitHooker
|
|
92
92
|
end
|
93
93
|
|
94
94
|
def match_phase(phase = :any)
|
95
|
-
|
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)
|
data/lib/githooker/runner.rb
CHANGED
@@ -8,7 +8,9 @@ module GitHooker
|
|
8
8
|
|
9
9
|
success = Hook.run
|
10
10
|
|
11
|
-
Hook.sections.
|
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
|
|
data/lib/githooker/section.rb
CHANGED
@@ -16,10 +16,14 @@ module GitHooker
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def actions
|
19
|
-
@actions.
|
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
|