delayed_job 3.0.0.pre4 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.textile CHANGED
@@ -14,27 +14,43 @@ It is a direct extraction from Shopify where the job table is responsible for a
14
14
 
15
15
  "Follow us on Twitter":https://twitter.com/delayedjob to get updates and notices about new releases.
16
16
 
17
-
18
17
  h2. Installation
19
18
 
20
- delayed_job 2.1 only supports Rails 3.0+. See the "2.0 branch":https://github.com/collectiveidea/delayed_job/tree/v2.0 for Rails 2.
19
+ delayed_job 3.0.0 only supports Rails 3.0+. See the "2.0 branch":https://github.com/collectiveidea/delayed_job/tree/v2.0 for Rails 2.
20
+
21
+ If you plan to use delayed_job with Active Record, add @delayed_job_active_record@ to your @Gemfile@.
22
+
23
+ <pre>
24
+ gem 'delayed_job_active_record'
25
+ </pre>
21
26
 
22
- To install, add delayed_job to your @Gemfile@ and run `bundle install`:
27
+ If you plan to use delayed_job with Mongoid, add @delayed_job_mongoid@ to your @Gemfile@.
23
28
 
24
29
  <pre>
25
- gem 'delayed_job'
30
+ gem 'delayed_job_mongoid'
26
31
  </pre>
27
32
 
28
- After delayed_job is installed, you will need to setup the backend.
33
+ Run @bundle install@ to install the backend and delayed_job gems.
29
34
 
30
35
  h3. Backends
31
36
 
32
37
  delayed_job supports multiple backends for storing the job queue. "See the wiki for other backends":http://wiki.github.com/collectiveidea/delayed_job/backends besides Active Record.
33
38
 
34
- The default is Active Record, which requires a jobs table.
39
+ The default is Active Record, which requires a jobs table. You can create that table by running the following command:
40
+
41
+ <pre>
42
+ $ script/rails generate delayed_job:active_record
43
+ $ rake db:migrate
44
+ </pre>
45
+
46
+ h3. Upgrading from 2.x to 3.0.0 on Active Record
47
+
48
+ Delayed Job 3.0.0 introduces a new column to the delayed_jobs table.
49
+
50
+ If you're upgrading from Delayed Job 2.x, run the upgrade generator to create a migration to add the column.
35
51
 
36
52
  <pre>
37
- $ script/rails generate delayed_job
53
+ $ script/rails generate delayed_job:upgrade
38
54
  $ rake db:migrate
39
55
  </pre>
40
56
 
@@ -113,7 +129,11 @@ Remove the @.deliver@ method to make it work. It's not ideal, but it's the best
113
129
 
114
130
  h2. Running Jobs
115
131
 
116
- @script/delayed_job@ can be used to manage a background process which will start working off jobs. Make sure you've run `script/generate delayed_job`.
132
+ @script/delayed_job@ can be used to manage a background process which will start working off jobs.
133
+
134
+ To do so, add @gem "daemons"@ to your @Gemfile@ and make sure you've run `script/rails generate delayed_job`.
135
+
136
+ You can then do the following:
117
137
 
118
138
  <pre>
119
139
  $ RAILS_ENV=production script/delayed_job start
@@ -169,7 +189,7 @@ class ParanoidNewsletterJob < NewsletterJob
169
189
  end
170
190
 
171
191
  def error(job, exception)
172
- notify_hoptoad(exception)
192
+ Airbrake.notify(exception)
173
193
  end
174
194
 
175
195
  def failure
@@ -180,18 +200,19 @@ end
180
200
 
181
201
  h2. Gory Details
182
202
 
183
- The library evolves around a delayed_jobs table which looks as follows:
203
+ The library revolves around a delayed_jobs table which looks as follows:
184
204
 
185
205
  <pre>
186
206
  create_table :delayed_jobs, :force => true do |table|
187
207
  table.integer :priority, :default => 0 # Allows some jobs to jump to the front of the queue
188
208
  table.integer :attempts, :default => 0 # Provides for retries, but still fail eventually.
189
209
  table.text :handler # YAML-encoded string of the object that will do work
190
- table.text :last_error # reason for last failure (See Note below)
210
+ table.text :last_error # reason for last failure (See Note below)
191
211
  table.datetime :run_at # When to run. Could be Time.zone.now for immediately, or sometime in the future.
192
212
  table.datetime :locked_at # Set when a client is working on this object
193
213
  table.datetime :failed_at # Set when all retries have failed (actually, by default, the record is deleted instead)
194
214
  table.string :locked_by # Who is working on this object (if locked)
215
+ table.string :queue # The name of the queue this job is in
195
216
  table.timestamps
196
217
  end
197
218
  </pre>
@@ -230,6 +251,14 @@ h2. Mailing List
230
251
 
231
252
  Join us on the "mailing list":http://groups.google.com/group/delayed_job
232
253
 
254
+ h2. Build Status
255
+
256
+ "!http://travis-ci.org/collectiveidea/delayed_job.png!":http://travis-ci.org/collectiveidea/delayed_job
257
+
258
+ h2. Dependency Status
259
+
260
+ "!https://gemnasium.com/collectiveidea/delayed_job.png?travis!":https://gemnasium.com/collectiveidea/delayed_job
261
+
233
262
  h2. How to contribute
234
263
 
235
264
  If you find what looks like a bug:
@@ -1,4 +1,8 @@
1
- require 'daemons'
1
+ begin
2
+ require 'daemons'
3
+ rescue LoadError
4
+ raise "You need to add gem 'daemons' to your Gemfile if you wish to use it."
5
+ end
2
6
  require 'optparse'
3
7
 
4
8
  module Delayed
@@ -37,7 +37,7 @@ module Delayed
37
37
 
38
38
  def self.backend=(backend)
39
39
  if backend.is_a? Symbol
40
- require "delayed/serialization/#{backend}" if YAML.parser.class.name =~ /syck/i
40
+ require "delayed/serialization/#{backend}"
41
41
  require "delayed/backend/#{backend}"
42
42
  backend = "Delayed::Backend::#{backend.to_s.classify}::Job".constantize
43
43
  end
data/lib/delayed_job.rb CHANGED
@@ -1,22 +1,21 @@
1
1
  require 'active_support'
2
-
3
- require File.dirname(__FILE__) + '/delayed/message_sending'
4
- require File.dirname(__FILE__) + '/delayed/performable_method'
2
+ require 'delayed/message_sending'
3
+ require 'delayed/performable_method'
5
4
 
6
5
  # PerformableMailer is compatible with ActionMailer 3 (and possibly 3.1)
7
6
  if defined?(ActionMailer)
8
7
  require 'action_mailer/version'
9
- require File.dirname(__FILE__) + '/delayed/performable_mailer' if 3 == ActionMailer::VERSION::MAJOR
8
+ require 'delayed/performable_mailer' if 3 == ActionMailer::VERSION::MAJOR
10
9
  end
11
10
 
12
- require File.dirname(__FILE__) + '/delayed/yaml_ext'
13
- require File.dirname(__FILE__) + '/delayed/lifecycle'
14
- require File.dirname(__FILE__) + '/delayed/plugin'
15
- require File.dirname(__FILE__) + '/delayed/plugins/clear_locks'
16
- require File.dirname(__FILE__) + '/delayed/backend/base'
17
- require File.dirname(__FILE__) + '/delayed/worker'
18
- require File.dirname(__FILE__) + '/delayed/deserialization_error'
19
- require File.dirname(__FILE__) + '/delayed/railtie' if defined?(Rails::Railtie)
11
+ require 'delayed/yaml_ext'
12
+ require 'delayed/lifecycle'
13
+ require 'delayed/plugin'
14
+ require 'delayed/plugins/clear_locks'
15
+ require 'delayed/backend/base'
16
+ require 'delayed/worker'
17
+ require 'delayed/deserialization_error'
18
+ require 'delayed/railtie' if defined?(Rails::Railtie)
20
19
 
21
20
  Object.send(:include, Delayed::MessageSending)
22
21
  Module.send(:include, Delayed::MessageSending::ClassMethods)
@@ -1,11 +1,11 @@
1
1
  require 'rails/generators'
2
2
 
3
3
  class DelayedJobGenerator < Rails::Generators::Base
4
-
4
+
5
5
  self.source_paths << File.join(File.dirname(__FILE__), 'templates')
6
-
6
+
7
7
  def create_script_file
8
8
  template 'script', 'script/delayed_job'
9
9
  chmod 'script/delayed_job', 0755
10
10
  end
11
- end
11
+ end
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  require 'action_mailer'
4
4
  class MyMailer < ActionMailer::Base
5
5
  def signup(email)
6
- mail :to => email, :subject => "Delaying Emails"
6
+ mail :to => email, :subject => "Delaying Emails", :from => "delayedjob@example.com"
7
7
  end
8
8
  end
9
9
 
metadata CHANGED
@@ -1,15 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: delayed_job
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1923832001
5
- prerelease: 6
4
+ hash: 7
5
+ prerelease:
6
6
  segments:
7
7
  - 3
8
8
  - 0
9
9
  - 0
10
- - pre
11
- - 4
12
- version: 3.0.0.pre4
10
+ version: 3.0.0
13
11
  platform: ruby
14
12
  authors:
15
13
  - Matt Griffin
@@ -22,28 +20,10 @@ autorequire:
22
20
  bindir: bin
23
21
  cert_chain: []
24
22
 
25
- date: 2011-11-14 00:00:00 Z
23
+ date: 2011-12-30 00:00:00 Z
26
24
  dependencies:
27
25
  - !ruby/object:Gem::Dependency
28
- type: :runtime
29
- prerelease: false
30
- requirement: &id001 !ruby/object:Gem::Requirement
31
- none: false
32
- requirements:
33
- - - "="
34
- - !ruby/object:Gem::Version
35
- hash: 3
36
- segments:
37
- - 1
38
- - 0
39
- - 10
40
- version: 1.0.10
41
- version_requirements: *id001
42
- name: daemons
43
- - !ruby/object:Gem::Dependency
44
- type: :runtime
45
- prerelease: false
46
- requirement: &id002 !ruby/object:Gem::Requirement
26
+ version_requirements: &id001 !ruby/object:Gem::Requirement
47
27
  none: false
48
28
  requirements:
49
29
  - - ~>
@@ -53,12 +33,12 @@ dependencies:
53
33
  - 3
54
34
  - 0
55
35
  version: "3.0"
56
- version_requirements: *id002
36
+ requirement: *id001
37
+ type: :runtime
38
+ prerelease: false
57
39
  name: activesupport
58
40
  - !ruby/object:Gem::Dependency
59
- type: :development
60
- prerelease: false
61
- requirement: &id003 !ruby/object:Gem::Requirement
41
+ version_requirements: &id002 !ruby/object:Gem::Requirement
62
42
  none: false
63
43
  requirements:
64
44
  - - ~>
@@ -68,12 +48,12 @@ dependencies:
68
48
  - 3
69
49
  - 0
70
50
  version: "3.0"
71
- version_requirements: *id003
72
- name: activerecord
73
- - !ruby/object:Gem::Dependency
51
+ requirement: *id002
74
52
  type: :development
75
53
  prerelease: false
76
- requirement: &id004 !ruby/object:Gem::Requirement
54
+ name: activerecord
55
+ - !ruby/object:Gem::Dependency
56
+ version_requirements: &id003 !ruby/object:Gem::Requirement
77
57
  none: false
78
58
  requirements:
79
59
  - - ">="
@@ -82,12 +62,12 @@ dependencies:
82
62
  segments:
83
63
  - 0
84
64
  version: "0"
85
- version_requirements: *id004
86
- name: sqlite3
87
- - !ruby/object:Gem::Dependency
65
+ requirement: *id003
88
66
  type: :development
89
67
  prerelease: false
90
- requirement: &id005 !ruby/object:Gem::Requirement
68
+ name: sqlite3
69
+ - !ruby/object:Gem::Dependency
70
+ version_requirements: &id004 !ruby/object:Gem::Requirement
91
71
  none: false
92
72
  requirements:
93
73
  - - ~>
@@ -97,12 +77,12 @@ dependencies:
97
77
  - 3
98
78
  - 0
99
79
  version: "3.0"
100
- version_requirements: *id005
101
- name: rails
102
- - !ruby/object:Gem::Dependency
80
+ requirement: *id004
103
81
  type: :development
104
82
  prerelease: false
105
- requirement: &id006 !ruby/object:Gem::Requirement
83
+ name: rails
84
+ - !ruby/object:Gem::Dependency
85
+ version_requirements: &id005 !ruby/object:Gem::Requirement
106
86
  none: false
107
87
  requirements:
108
88
  - - ~>
@@ -112,12 +92,12 @@ dependencies:
112
92
  - 2
113
93
  - 0
114
94
  version: "2.0"
115
- version_requirements: *id006
116
- name: rspec
117
- - !ruby/object:Gem::Dependency
95
+ requirement: *id005
118
96
  type: :development
119
97
  prerelease: false
120
- requirement: &id007 !ruby/object:Gem::Requirement
98
+ name: rspec
99
+ - !ruby/object:Gem::Dependency
100
+ version_requirements: &id006 !ruby/object:Gem::Requirement
121
101
  none: false
122
102
  requirements:
123
103
  - - ">="
@@ -126,15 +106,16 @@ dependencies:
126
106
  segments:
127
107
  - 0
128
108
  version: "0"
129
- version_requirements: *id007
109
+ requirement: *id006
110
+ type: :development
111
+ prerelease: false
130
112
  name: rake
131
113
  description: |-
132
114
  Delayed_job (or DJ) encapsulates the common pattern of asynchronously executing longer tasks in the background. It is a direct extraction from Shopify where the job table is responsible for a multitude of core tasks.
133
115
 
134
116
  This gem is collectiveidea's fork (http://github.com/collectiveidea/delayed_job).
135
117
  email:
136
- - chris@collectiveidea.com
137
- - brandon@opensoul.org
118
+ - brian@collectiveidea.com
138
119
  executables: []
139
120
 
140
121
  extensions: []
@@ -207,14 +188,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
207
188
  required_rubygems_version: !ruby/object:Gem::Requirement
208
189
  none: false
209
190
  requirements:
210
- - - ">"
191
+ - - ">="
211
192
  - !ruby/object:Gem::Version
212
- hash: 25
193
+ hash: 3
213
194
  segments:
214
- - 1
215
- - 3
216
- - 1
217
- version: 1.3.1
195
+ - 0
196
+ version: "0"
218
197
  requirements: []
219
198
 
220
199
  rubyforge_project: