simplejob 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/simplejob/client.rb +1 -1
- data/lib/simplejob/hash_extensions.rb +15 -0
- data/lib/simplejob/worker.rb +1 -1
- data/lib/simplejob.rb +1 -0
- data/simplejob.gemspec +3 -2
- metadata +5 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
data/lib/simplejob/client.rb
CHANGED
@@ -48,7 +48,7 @@ module SimpleJob
|
|
48
48
|
alias_method :orig_send, :send
|
49
49
|
def send(topic, props = {})
|
50
50
|
raise "Message properties should be a Hash" unless props.kind_of?(Hash)
|
51
|
-
log.info "[simplejob] New job: #{topic}, #{props.
|
51
|
+
log.info "[simplejob] New job: #{topic}, #{props.truncated_inspect}"
|
52
52
|
publish(topic, props.to_json)
|
53
53
|
end
|
54
54
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class Hash
|
2
|
+
|
3
|
+
def truncated_inspect(length = 256)
|
4
|
+
values = self.collect do |key, value|
|
5
|
+
"#{key.inspect} => #{truncated_value(value, length)}"
|
6
|
+
end
|
7
|
+
"{#{values.join(', ')}}"
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def truncated_value(value, length)
|
13
|
+
value.is_a?(String) && value.length > length ? (value[0 .. length - 3] + "...").inspect : value.inspect
|
14
|
+
end
|
15
|
+
end
|
data/lib/simplejob/worker.rb
CHANGED
@@ -44,7 +44,7 @@ module SimpleJob
|
|
44
44
|
|
45
45
|
props = JSON.parse(body).with_indifferent_access
|
46
46
|
props[:topic] = topic
|
47
|
-
log.info "[worker] Props: #{props.
|
47
|
+
log.info "[worker] Props: #{props.truncated_inspect}"
|
48
48
|
|
49
49
|
if handler = find_handler(topic)
|
50
50
|
handler.call(props)
|
data/lib/simplejob.rb
CHANGED
data/simplejob.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{simplejob}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = [%q{Ken Pratt}]
|
12
|
-
s.date = %q{2011-07
|
12
|
+
s.date = %q{2011-09-07}
|
13
13
|
s.description = %q{A simple AMQP-backed job queuing system.}
|
14
14
|
s.email = %q{ken@kenpratt.net}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -38,6 +38,7 @@ Gem::Specification.new do |s|
|
|
38
38
|
"examples/wildcard_handlers/wiretap.rb",
|
39
39
|
"lib/simplejob.rb",
|
40
40
|
"lib/simplejob/client.rb",
|
41
|
+
"lib/simplejob/hash_extensions.rb",
|
41
42
|
"lib/simplejob/worker.rb",
|
42
43
|
"simplejob.gemspec",
|
43
44
|
"test/helper.rb",
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simplejob
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 2
|
10
|
+
version: 0.2.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ken Pratt
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-07
|
18
|
+
date: 2011-09-07 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: activesupport
|
@@ -96,6 +96,7 @@ files:
|
|
96
96
|
- examples/wildcard_handlers/wiretap.rb
|
97
97
|
- lib/simplejob.rb
|
98
98
|
- lib/simplejob/client.rb
|
99
|
+
- lib/simplejob/hash_extensions.rb
|
99
100
|
- lib/simplejob/worker.rb
|
100
101
|
- simplejob.gemspec
|
101
102
|
- test/helper.rb
|