auxesis-flapjack 0.4.6 → 0.4.8
Sign up to get free protection for your applications and to get access to all the features.
@@ -16,8 +16,16 @@ options = Flapjack::NotifierManagerOptions.parse(args)
|
|
16
16
|
worker_path = File.join(File.dirname(__FILE__), 'flapjack-notifier')
|
17
17
|
|
18
18
|
# set up pid dir
|
19
|
-
pid_dir = "/var/run/flapjack"
|
20
|
-
|
19
|
+
pid_dir = "/var/run/flapjack/"
|
20
|
+
unless File.exists?(pid_dir)
|
21
|
+
puts "#{pid_dir} doesn't exist."
|
22
|
+
exit 2
|
23
|
+
end
|
24
|
+
|
25
|
+
unless File.writable?(pid_dir)
|
26
|
+
puts "Can't write to #{pid_dir} - check permissions?"
|
27
|
+
exit 2
|
28
|
+
end
|
21
29
|
|
22
30
|
daemon_args = (args + ['--', '--beanstalk', options.host,
|
23
31
|
'--port', options.port.to_s,
|
data/flapjack.gemspec
CHANGED
@@ -41,15 +41,17 @@ module Flapjack
|
|
41
41
|
options.host ||= "localhost"
|
42
42
|
options.port ||= 11300
|
43
43
|
|
44
|
-
unless
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
44
|
+
unless ARGV[0] == "stop"
|
45
|
+
unless options.recipients =~ /.+/
|
46
|
+
puts "You must specify a recipients file!\n\n"
|
47
|
+
puts opts
|
48
|
+
exit 2
|
49
|
+
end
|
50
|
+
|
51
|
+
unless File.exists?(options.recipients)
|
52
|
+
puts "The specified recipients file doesn't exist!"
|
53
|
+
exit 2
|
54
|
+
end
|
53
55
|
end
|
54
56
|
|
55
57
|
unless %w(start stop restart).include?(args[0])
|
@@ -11,7 +11,7 @@ module Flapjack
|
|
11
11
|
|
12
12
|
def initialize(opts={})
|
13
13
|
@from_address = opts[:from_address]
|
14
|
-
@website_uri = opts[:website_uri].gsub(/\/$/, '')
|
14
|
+
@website_uri = opts[:website_uri] ? opts[:website_uri].gsub(/\/$/, '') : "http://#{`hostname`}"
|
15
15
|
@log = opts[:logger]
|
16
16
|
@log ||= Log4r::Logger.new("notifier")
|
17
17
|
end
|
@@ -10,10 +10,16 @@ module Flapjack
|
|
10
10
|
|
11
11
|
@jid = opts[:jid]
|
12
12
|
@password = opts[:password]
|
13
|
+
@log = opts[:logger]
|
13
14
|
unless @jid && @password
|
14
15
|
raise ArgumentError, "You have to provide a username and password"
|
15
16
|
end
|
16
|
-
|
17
|
+
|
18
|
+
begin
|
19
|
+
@xmpp = Jabber::Simple.new(@jid, @password)
|
20
|
+
rescue SocketError => e
|
21
|
+
@log.error("XMPP: #{e.message}")
|
22
|
+
end
|
17
23
|
|
18
24
|
end
|
19
25
|
|
data/lib/flapjack/patches.rb
CHANGED