Browse files

Base post-receive hook now calls multiple scripts

It's a bit of a hack for now, it'll just find any post-receive-*.rb
scripts in the directory and load them all one by one. CONFIG is
loaded once from the yml at the start.
  • Loading branch information...
1 parent 02dc662 commit 2b513123e1687fb116b2949e7f87e1088abab039 @marcins committed Feb 7, 2013
Showing with 13 additions and 2 deletions.
  1. +13 −2 post-receive
@@ -1,4 +1,15 @@
#!/usr/bin/env ruby
-# Call to post-speak hook
-load File.join(File.dirname(__FILE__), 'post-receive-hipchat.rb') if File.exist?(File.join(File.dirname(__FILE__), 'post-receive-hipchat.rb'))
+require 'yaml'
+CONFIG = YAML::load(, 'config.yml')))
+scripts_glob = File.join(File.dirname(__FILE__), "post-receive-*.rb")
+Dir.glob scripts_glob do |filename|
+ script = File.basename(filename, ".rb")
+ puts "post-receive: #{script}"
+ begin
+ load filename
+ rescue Exception => e
+ puts "post-receive: #{script} FAILED: #{e}"
+ end

0 comments on commit 2b51312

Please sign in to comment.