orionz-minion 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/minion.rb +13 -5
  3. metadata +4 -3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.5
1
+ 0.1.6
@@ -47,7 +47,7 @@ module Minion
47
47
  begin
48
48
  log "recv: #{queue}:#{m}"
49
49
 
50
- args = JSON.load(m)
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 amqp_uri
89
- ENV["AMQP_URI"] || "amqp://guest:guest@localhost/"
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(amqp_uri)
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 AMQP_URI: #{uri.inspect}"
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: orionz-minion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
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-09 00:00:00 -07:00
12
+ date: 2009-09-22 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -60,6 +60,7 @@ files:
60
60
  - lib/minion/handler.rb
61
61
  has_rdoc: false
62
62
  homepage: http://github.com/orionz/minion
63
+ licenses:
63
64
  post_install_message:
64
65
  rdoc_options:
65
66
  - --charset=UTF-8
@@ -80,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
81
  requirements: []
81
82
 
82
83
  rubyforge_project: minion
83
- rubygems_version: 1.2.0
84
+ rubygems_version: 1.3.5
84
85
  signing_key:
85
86
  specification_version: 2
86
87
  summary: Super simple job queue over AMQP