acts_as_async 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +7 -11
- data/lib/acts_as_async/helper.rb +10 -11
- data/lib/acts_as_async/version.rb +1 -1
- metadata +12 -12
data/README.md
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
# ActsAsAsync
|
1
|
+
# ActsAsAsync [![Build Status](https://secure.travis-ci.org/bloudermilk/acts_as_async.png?branch=master)][travis] [![Dependency Status](https://gemnasium.com/bloudermilk/acts_as_async.png?travis)][gemnasium]
|
2
2
|
|
3
3
|
ActsAsAsync is an ActiveRecord extension that provides your models with
|
4
4
|
easy-to-use Resque helpers.
|
5
5
|
|
6
|
+
[travis]: http://travis-ci.org/bloudermilk/acts_as_async
|
7
|
+
[gemnasium]: https://gemnasium.com/bloudermilk/acts_as_async
|
8
|
+
|
6
9
|
|
7
10
|
## Installation
|
8
11
|
|
9
12
|
Installing ActsAsAsync is as simple as adding it to your Gemfile:
|
10
13
|
|
11
|
-
```
|
12
|
-
$ cat Gemfile
|
13
|
-
...
|
14
|
+
```ruby
|
14
15
|
gem "acts_as_async"
|
15
|
-
...
|
16
16
|
```
|
17
17
|
|
18
18
|
|
@@ -92,7 +92,7 @@ book.async_paint_in(2.years, "blue")
|
|
92
92
|
* You can pass any number of additional arguments to async'd methods so long
|
93
93
|
as they can be serialized into JSON
|
94
94
|
* Adding acts_as_async to your Gemfile automatically loads both Resque and
|
95
|
-
Resque-scheduler's rake tasks. This means you can use both
|
95
|
+
Resque-scheduler's rake tasks. This means you can use both
|
96
96
|
`$ rake resque:work` and `$ rake resque:scheduler` right out of the box.
|
97
97
|
* By deafult, each model will add tasks to a queue named "default". You can
|
98
98
|
pass the `:queue` option to `acts_as_async` to specify a different queue.
|
@@ -104,7 +104,7 @@ book.async_paint_in(2.years, "blue")
|
|
104
104
|
|
105
105
|
## Everything else...
|
106
106
|
|
107
|
-
ActsAsAsync is simply a thin layer on top of [Resque][resque] and
|
107
|
+
ActsAsAsync is simply a thin layer on top of [Resque][resque] and
|
108
108
|
[Resque-scheduler][resque_scheduler]. To learn how to configure your redis
|
109
109
|
connection, run workers, view the web interface, and more visit their home
|
110
110
|
pages.
|
@@ -118,10 +118,6 @@ pages.
|
|
118
118
|
ActsAsAsync is tested against the following Rubies: MRI 1.8.7, MRI 1.9.2,
|
119
119
|
MRI 1.9.3, Rubinius 2.0, and JRuby.
|
120
120
|
|
121
|
-
![Build Status](https://secure.travis-ci.org/bloudermilk/acts_as_async.png?branch=master&.png)
|
122
|
-
|
123
|
-
[Build History](http://travis-ci.org/#!/bloudermilk/acts_as_async)
|
124
|
-
|
125
121
|
|
126
122
|
## License
|
127
123
|
|
data/lib/acts_as_async/helper.rb
CHANGED
@@ -40,21 +40,20 @@ module ActsAsAsync
|
|
40
40
|
def inherited(subclass)
|
41
41
|
queue = instance_variable_get(:@queue)
|
42
42
|
subclass.instance_variable_set(:@queue, queue)
|
43
|
+
super
|
43
44
|
end
|
44
45
|
end
|
45
46
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
end
|
47
|
+
def async(method, *args)
|
48
|
+
Resque.enqueue(self.class, id, method, *args)
|
49
|
+
end
|
50
50
|
|
51
|
-
|
52
|
-
|
53
|
-
|
51
|
+
def async_at(time, method, *args)
|
52
|
+
Resque.enqueue_at(time, self.class, id, method, *args)
|
53
|
+
end
|
54
54
|
|
55
|
-
|
56
|
-
|
57
|
-
end
|
55
|
+
def async_in(time, method, *args)
|
56
|
+
Resque.enqueue_in(time, self.class, id, method, *args)
|
58
57
|
end
|
59
58
|
|
60
59
|
module SharedMethods
|
@@ -85,7 +84,7 @@ module ActsAsAsync
|
|
85
84
|
|
86
85
|
# Use respond_to_missing? on newer Ruby versions but fall back to
|
87
86
|
# overriding respond_to? on older versions. In both cases, return
|
88
|
-
# true for any match, even if the method to be async'd doesn't
|
87
|
+
# true for any match, even if the method to be async'd doesn't
|
89
88
|
# exist, since technically we do respond to that method but throw
|
90
89
|
# an exception.
|
91
90
|
if RUBY_VERSION >= "1.9.2"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_async
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-03-24 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: resque
|
16
|
-
requirement: &
|
16
|
+
requirement: &70215347189980 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70215347189980
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: resque-scheduler
|
27
|
-
requirement: &
|
27
|
+
requirement: &70215347189120 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70215347189120
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: activesupport
|
38
|
-
requirement: &
|
38
|
+
requirement: &70215347188420 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70215347188420
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: activerecord
|
49
|
-
requirement: &
|
49
|
+
requirement: &70215347187340 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70215347187340
|
58
58
|
description: ActsAsAsync is an ActiveRecord extension that provides your models with
|
59
59
|
easy-to-use Resque helpers.
|
60
60
|
email:
|
@@ -85,7 +85,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
85
85
|
version: '0'
|
86
86
|
segments:
|
87
87
|
- 0
|
88
|
-
hash:
|
88
|
+
hash: -2661663701972156557
|
89
89
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
90
|
none: false
|
91
91
|
requirements:
|
@@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
94
|
version: '0'
|
95
95
|
segments:
|
96
96
|
- 0
|
97
|
-
hash:
|
97
|
+
hash: -2661663701972156557
|
98
98
|
requirements: []
|
99
99
|
rubyforge_project:
|
100
100
|
rubygems_version: 1.8.10
|