From edf6fe21bf5eca24e95bfa5061af9c17f8d6e1d7 Mon Sep 17 00:00:00 2001 From: Christian Johansen Date: Fri, 27 May 2011 12:56:54 +0000 Subject: Properly set up load path and configure the messaging module in the post receive hook --- (limited to 'data') diff --git a/data/hooks/messaging.rb b/data/hooks/messaging.rb index f2a59d1..3ed7900 100644 --- a/data/hooks/messaging.rb +++ b/data/hooks/messaging.rb @@ -17,17 +17,20 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . #++ +print "=> Syncing Gitorious... " +RAILS_ENV = ENV['RAILS_ENV'] || "production" +RAILS_ROOT = File.join(File.dirname(__FILE__), "..", "..") + +$: << File.join(RAILS_ROOT, "lib") require 'rubygems' require 'yaml' require 'gitorious/messaging' -print "=> Syncing Gitorious... " -RAILS_ENV = ENV['RAILS_ENV'] || "production" - if !defined?(GitoriousConfig) - conf = YAML::load_file(File.join(File.dirname(__FILE__), "..", "..", "config", "gitorious.yml")) - GitoriousConfig = conf[RAILS_ENV] - Gitorious::Messaging.configure(config) + conf = YAML::load_file(File.join(RAILS_ROOT, "config", "gitorious.yml")) + GitoriousConfig = conf[RAILS_ENV] + Gitorious::Messaging.load_adapter(GitoriousConfig["messaging_adapter"]) + Gitorious::Messaging.configure_publisher(GitoriousConfig["messaging_adapter"]) end class Publisher -- cgit v0.9.1