Sha256: eb3d2980d4211a77bea4a03e3f4f679ccc9f5c7c956765359f4cce51e96c679a
Contents?: true
Size: 929 Bytes
Versions: 1
Compression:
Stored size: 929 Bytes
Contents
module SuperHooks # Class responsible for running the hooks and reporting on status class Runner # the hooks one would like to run attr_reader :hooks # arguments passed by git when running a hook attr_reader :arguments # Prepare for a new commit runner check # # * hook: the hook name wer're about to run # * arguments: the arguments past to the hook # def initialize(hook, arguments) @hooks = Hook.where(kind: [hook]) @arguments = arguments end # Run all the associated hooks # # Exit the program with a bad status if any of the hooks fail # def run failed_hooks = [] hooks.each do |hook| failed_hooks << hook unless hook.execute!(arguments) end unless failed_hooks.empty? $stderr.puts "Hooks #{failed_hooks.map(&:path).join(', ')} failed to exit successfully" exit 1 end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
super_hooks-0.0.2.1 | lib/super_hooks/runner.rb |