minion 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/minion.rb +13 -5
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.6
|
data/lib/minion.rb
CHANGED
@@ -47,7 +47,7 @@ module Minion
|
|
47
47
|
begin
|
48
48
|
log "recv: #{queue}:#{m}"
|
49
49
|
|
50
|
-
args =
|
50
|
+
args = decode_json(m)
|
51
51
|
|
52
52
|
result = yield(args)
|
53
53
|
|
@@ -65,6 +65,14 @@ module Minion
|
|
65
65
|
@@handlers << handler
|
66
66
|
end
|
67
67
|
|
68
|
+
def decode_json(string)
|
69
|
+
if defined? ActiveSupport
|
70
|
+
ActiveSupport::JSON.decode string
|
71
|
+
else
|
72
|
+
JSON.load string
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
68
76
|
def check_all
|
69
77
|
@@handlers.each { |h| h.check }
|
70
78
|
end
|
@@ -85,12 +93,12 @@ module Minion
|
|
85
93
|
|
86
94
|
private
|
87
95
|
|
88
|
-
def
|
89
|
-
ENV["
|
96
|
+
def amqp_url
|
97
|
+
ENV["AMQP_URL"] || "amqp://guest:guest@localhost/"
|
90
98
|
end
|
91
99
|
|
92
100
|
def amqp_config
|
93
|
-
uri = URI.parse(
|
101
|
+
uri = URI.parse(amqp_url)
|
94
102
|
{
|
95
103
|
:vhost => uri.path,
|
96
104
|
:host => uri.host,
|
@@ -99,7 +107,7 @@ module Minion
|
|
99
107
|
:pass => uri.password
|
100
108
|
}
|
101
109
|
rescue
|
102
|
-
raise "invalid
|
110
|
+
raise "invalid AMQP_URL: #{uri.inspect} (#{e})"
|
103
111
|
end
|
104
112
|
|
105
113
|
def new_bunny
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Orion Henry
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-09-
|
12
|
+
date: 2009-09-22 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|