cloudist 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/cloudist.gemspec +3 -2
- data/examples/sandwich_client.rb +5 -0
- data/lib/cloudist.rb +1 -0
- data/lib/cloudist/callback.rb +2 -14
- data/lib/cloudist/callback_methods.rb +19 -0
- data/lib/cloudist/listener.rb +12 -0
- metadata +5 -4
data/Rakefile
CHANGED
@@ -16,7 +16,7 @@ Jeweler::Tasks.new do |gem|
|
|
16
16
|
gem.homepage = "http://github.com/ivanvanderbyl/cloudist"
|
17
17
|
gem.license = "MIT"
|
18
18
|
gem.summary = %Q{Super fast job queue using AMQP}
|
19
|
-
gem.description = %Q{Cloudist is a simple, highly scalable job queue for Ruby applications, it can run within Rails, or
|
19
|
+
gem.description = %Q{Cloudist is a simple, highly scalable job queue for Ruby applications, it can run within Rails, DaemonKit or your own custom application. Refer to github page for examples}
|
20
20
|
gem.email = "ivanvanderbyl@me.com"
|
21
21
|
gem.authors = ["Ivan Vanderbyl"]
|
22
22
|
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/cloudist.gemspec
CHANGED
@@ -5,12 +5,12 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{cloudist}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ivan Vanderbyl"]
|
12
12
|
s.date = %q{2011-01-18}
|
13
|
-
s.description = %q{Cloudist is a simple, highly scalable job queue for Ruby applications, it can run within Rails, or
|
13
|
+
s.description = %q{Cloudist is a simple, highly scalable job queue for Ruby applications, it can run within Rails, DaemonKit or your own custom application. Refer to github page for examples}
|
14
14
|
s.email = %q{ivanvanderbyl@me.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE.txt",
|
@@ -32,6 +32,7 @@ Gem::Specification.new do |s|
|
|
32
32
|
"lib/cloudist.rb",
|
33
33
|
"lib/cloudist/basic_queue.rb",
|
34
34
|
"lib/cloudist/callback.rb",
|
35
|
+
"lib/cloudist/callback_methods.rb",
|
35
36
|
"lib/cloudist/core_ext/string.rb",
|
36
37
|
"lib/cloudist/errors.rb",
|
37
38
|
"lib/cloudist/job.rb",
|
data/examples/sandwich_client.rb
CHANGED
@@ -19,9 +19,14 @@ Cloudist.start {
|
|
19
19
|
|
20
20
|
log.info("Dispatching sandwich making job...")
|
21
21
|
enqueue('make.sandwich', {:bread => 'white'})
|
22
|
+
# enqueue('make.sandwich', {:bread => 'brown'})
|
22
23
|
|
23
24
|
# Listen to all sandwich jobs
|
24
25
|
listen('make.sandwich') {
|
26
|
+
everything {
|
27
|
+
Cloudist.log.info("Job ID: #{job_id}")
|
28
|
+
}
|
29
|
+
|
25
30
|
progress {
|
26
31
|
Cloudist.log.info("Progress: #{data[:progress]}")
|
27
32
|
}
|
data/lib/cloudist.rb
CHANGED
data/lib/cloudist/callback.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
module Cloudist
|
2
2
|
class Callback
|
3
|
-
|
3
|
+
include Cloudist::CallbackMethods
|
4
|
+
|
4
5
|
attr_reader :payload, :source
|
5
6
|
|
6
7
|
def initialize(source)
|
@@ -11,18 +12,5 @@ module Cloudist
|
|
11
12
|
@payload = payload
|
12
13
|
instance_eval(&source)
|
13
14
|
end
|
14
|
-
|
15
|
-
def data
|
16
|
-
payload.body
|
17
|
-
end
|
18
|
-
|
19
|
-
def headers
|
20
|
-
payload.headers
|
21
|
-
end
|
22
|
-
|
23
|
-
def runtime
|
24
|
-
|
25
|
-
end
|
26
|
-
|
27
15
|
end
|
28
16
|
end
|
data/lib/cloudist/listener.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
module Cloudist
|
2
2
|
class Listener
|
3
|
+
include Cloudist::CallbackMethods
|
3
4
|
|
4
5
|
attr_reader :job_queue_name, :job_id, :callbacks
|
5
6
|
|
@@ -30,6 +31,13 @@ module Cloudist
|
|
30
31
|
|
31
32
|
key = [payload.message_type.to_s, payload.headers[:event]].compact.join(':')
|
32
33
|
|
34
|
+
# If we want to get a callback on every event, do it here
|
35
|
+
if callbacks.has_key?('everything')
|
36
|
+
callbacks['everything'].each do |c|
|
37
|
+
c.call(payload)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
33
41
|
if callbacks.has_key?(key)
|
34
42
|
callbacks_to_call = callbacks[key]
|
35
43
|
callbacks_to_call.each do |c|
|
@@ -39,6 +47,10 @@ module Cloudist
|
|
39
47
|
end
|
40
48
|
end
|
41
49
|
|
50
|
+
def everything(&blk)
|
51
|
+
(@callbacks['everything'] ||= []) << Callback.new(blk)
|
52
|
+
end
|
53
|
+
|
42
54
|
def method_missing(meth, *args, &blk)
|
43
55
|
if @@valid_callbacks.include?(meth.to_s)
|
44
56
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ivan Vanderbyl
|
@@ -188,7 +188,7 @@ dependencies:
|
|
188
188
|
name: roodi
|
189
189
|
prerelease: false
|
190
190
|
version_requirements: *id011
|
191
|
-
description: Cloudist is a simple, highly scalable job queue for Ruby applications, it can run within Rails, or
|
191
|
+
description: Cloudist is a simple, highly scalable job queue for Ruby applications, it can run within Rails, DaemonKit or your own custom application. Refer to github page for examples
|
192
192
|
email: ivanvanderbyl@me.com
|
193
193
|
executables: []
|
194
194
|
|
@@ -213,6 +213,7 @@ files:
|
|
213
213
|
- lib/cloudist.rb
|
214
214
|
- lib/cloudist/basic_queue.rb
|
215
215
|
- lib/cloudist/callback.rb
|
216
|
+
- lib/cloudist/callback_methods.rb
|
216
217
|
- lib/cloudist/core_ext/string.rb
|
217
218
|
- lib/cloudist/errors.rb
|
218
219
|
- lib/cloudist/job.rb
|