Permalink
Browse files

god configs should make more sense

  • Loading branch information...
1 parent 7b64060 commit 9c81aea07c04660ae353d73f936240cfbfe41cdf @kennethkalmer committed Oct 6, 2009
Showing with 34 additions and 3 deletions.
  1. +1 −1 lib/daemon_kit/tasks/god.rake
  2. +31 −0 lib/daemon_kit/xmpp.rb
  3. +2 −2 templates/god/god.erb
View
2 lib/daemon_kit/tasks/god.rake
@@ -26,7 +26,7 @@ namespace :god do
f.write( ERB.new( t ).result( binding ) )
end
- puts "Monit config generated in config/#{name}.god"
+ puts "god config generated in config/#{name}.god"
end
desc "Load the god file into god"
View
31 lib/daemon_kit/xmpp.rb
@@ -0,0 +1,31 @@
+module DaemonKit
+ # Thin wrapper around the blather DSL
+ class XMPP
+ include ::Blather::DSL
+
+ class << self
+
+ def run( &block )
+ DaemonKit::EM.run
+
+ xmpp = new
+
+ xmpp.instance_eval( &block )
+
+ xmpp.run
+ end
+ end
+
+ def initialize
+ @config = DaemonKit::Config.load('jabber')
+
+ jid = if @config.resource
+ "#{@config.jabber_id}/#{@config.resource}"
+ else
+ @config.jabber_id
+ end
+
+ setup jid, @config.password
+ end
+ end
+end
View
4 templates/god/god.erb
@@ -9,8 +9,8 @@ DAEMON_ROOT = "<%= DaemonKit.root %>"
God.watch do |w|
w.name = '<%= DaemonKit.configuration.daemon_name %>'
w.interval = 30.seconds
- w.start = "/usr/bin/env DAEMON_ENV=<%= DaemonKit.env %> <%= DaemonKit.root %>/bin/<%= DaemonKit.configuration.daemon_name %> start"
- w.stop = "/usr/bin/env DAEMON_ENV=<%= DaemonKit.env %> <%= DaemonKit.root %>/bin/<%= DaemonKit.configuration.daemon_name %> stop"
+ w.start = "/usr/bin/env DAEMON_ENV=<%= DaemonKit.env %> #{DAEMON_ROOT}/bin/<%= DaemonKit.configuration.daemon_name %> start"
+ w.stop = "/usr/bin/env DAEMON_ENV=<%= DaemonKit.env %> #{DAEMON_ROOT}/bin/<%= DaemonKit.configuration.daemon_name %> stop"
w.start_grace = 10.seconds
w.stop_grace = 10.seconds
w.pid_file = "<%= DaemonKit.configuration.pid_file %>"

0 comments on commit 9c81aea

Please sign in to comment.