delayed_job_active_record 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # DelayedJob ActiveRecord Backend
1
+ # DelayedJob ActiveRecord Backend [![Build Status](http://travis-ci.org/collectiveidea/delayed_job_active_record.png)](https://travis-ci.org/collectiveidea/delayed_job_active_record) [![Dependency Status](https://gemnasium.com/collectiveidea/delayed_job_active_record.png)](https://gemnasium.com/collectiveidea/delayed_job_active_record)
2
2
 
3
3
  ## Installation
4
4
 
@@ -22,15 +22,6 @@ If you're upgrading from Delayed Job 2.x, run the upgrade generator to create a
22
22
 
23
23
  That's it. Use [delayed_job as normal](http://github.com/collectiveidea/delayed_job).
24
24
 
25
- ## Build Status
26
-
27
- [![Build Status](http://travis-ci.org/collectiveidea/delayed_job_active_record.png)](https://travis-ci.org/collectiveidea/delayed_job_active_record)
28
-
29
-
30
- ## Dependency Status
31
-
32
- [![Dependency Status](https://gemnasium.com/collectiveidea/delayed_job_active_record.png)](https://gemnasium.com/collectiveidea/delayed_job_active_record)
33
-
34
25
  ## How to contribute
35
26
 
36
27
  If you find what looks like a bug:
@@ -1,4 +1,3 @@
1
- require 'active_record'
2
1
  require 'active_record/version'
3
2
  module Delayed
4
3
  module Backend
@@ -17,14 +16,18 @@ module Delayed
17
16
  ::ActiveRecord::VERSION::MAJOR == 3
18
17
  end
19
18
 
19
+ delayed_job_table_name = "#{::ActiveRecord::Base.table_name_prefix}delayed_jobs"
20
+
20
21
  if rails3?
21
- self.table_name = 'delayed_jobs'
22
- scope :ready_to_run, lambda{|worker_name, max_run_time|
22
+ self.table_name = delayed_job_table_name
23
+ def self.ready_to_run(worker_name, max_run_time)
23
24
  where('(run_at <= ? AND (locked_at IS NULL OR locked_at < ?) OR locked_by = ?) AND failed_at IS NULL', db_time_now, db_time_now - max_run_time, worker_name)
24
- }
25
- scope :by_priority, order('priority ASC, run_at ASC')
25
+ end
26
+ def self.by_priority
27
+ order('priority ASC, run_at ASC')
28
+ end
26
29
  else
27
- set_table_name :delayed_jobs
30
+ set_table_name delayed_job_table_name
28
31
  named_scope :ready_to_run, lambda {|worker_name, max_run_time|
29
32
  { :conditions => ['(run_at <= ? AND (locked_at IS NULL OR locked_at < ?) OR locked_by = ?) AND failed_at IS NULL', db_time_now, db_time_now - max_run_time, worker_name] }
30
33
  }
@@ -56,4 +56,23 @@ describe Delayed::Backend::ActiveRecord::Job do
56
56
  Delayed::Backend::ActiveRecord::Job.find(job.id).handler.should_not be_blank
57
57
  end
58
58
  end
59
+
60
+ context "ActiveRecord::Base.table_name_prefix" do
61
+ def reload_job_class_definition
62
+ # If this can be done in a more sane manner, please fix it
63
+ load File.join File.dirname(__FILE__), '..', '..', '..', 'lib', 'delayed', 'backend', 'active_record.rb'
64
+ end
65
+
66
+ it "when prefix is not set, should use 'delayed_jobs' as table name" do
67
+ ::ActiveRecord::Base.table_name_prefix = nil
68
+ reload_job_class_definition
69
+ Delayed::Backend::ActiveRecord::Job.table_name.should eq 'delayed_jobs'
70
+ end
71
+
72
+ it "when prefix is set, should prepend it before default table name" do
73
+ ::ActiveRecord::Base.table_name_prefix = 'custom_'
74
+ reload_job_class_definition
75
+ Delayed::Backend::ActiveRecord::Job.table_name.should eq 'custom_delayed_jobs'
76
+ end
77
+ end
59
78
  end
metadata CHANGED
@@ -1,109 +1,114 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: delayed_job_active_record
3
- version: !ruby/object:Gem::Version
4
- hash: 23
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.3
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 3
9
- - 2
10
- version: 0.3.2
11
6
  platform: ruby
12
- authors:
13
- - Matt Griffin
7
+ authors:
14
8
  - Brian Ryckbost
9
+ - Matt Griffin
10
+ - Erik Michaels-Ober
15
11
  autorequire:
16
12
  bindir: bin
17
13
  cert_chain: []
18
-
19
- date: 2012-01-30 00:00:00 Z
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
22
- version_requirements: &id001 !ruby/object:Gem::Requirement
14
+ date: 2012-09-30 00:00:00.000000000 Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: activerecord
18
+ requirement: !ruby/object:Gem::Requirement
23
19
  none: false
24
- requirements:
25
- - - ">"
26
- - !ruby/object:Gem::Version
27
- hash: 11
28
- segments:
29
- - 2
30
- - 1
31
- - 0
20
+ requirements:
21
+ - - ! '>='
22
+ - !ruby/object:Gem::Version
32
23
  version: 2.1.0
33
- requirement: *id001
24
+ - - <
25
+ - !ruby/object:Gem::Version
26
+ version: '4'
34
27
  type: :runtime
35
28
  prerelease: false
36
- name: activerecord
37
- - !ruby/object:Gem::Dependency
38
- version_requirements: &id002 !ruby/object:Gem::Requirement
29
+ version_requirements: !ruby/object:Gem::Requirement
39
30
  none: false
40
- requirements:
31
+ requirements:
32
+ - - ! '>='
33
+ - !ruby/object:Gem::Version
34
+ version: 2.1.0
35
+ - - <
36
+ - !ruby/object:Gem::Version
37
+ version: '4'
38
+ - !ruby/object:Gem::Dependency
39
+ name: delayed_job
40
+ requirement: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
41
43
  - - ~>
42
- - !ruby/object:Gem::Version
43
- hash: 7
44
- segments:
45
- - 3
46
- - 0
47
- - 0
48
- version: 3.0.0
49
- requirement: *id002
44
+ - !ruby/object:Gem::Version
45
+ version: '3.0'
50
46
  type: :runtime
51
47
  prerelease: false
52
- name: delayed_job
53
- - !ruby/object:Gem::Dependency
54
- version_requirements: &id003 !ruby/object:Gem::Requirement
48
+ version_requirements: !ruby/object:Gem::Requirement
55
49
  none: false
56
- requirements:
50
+ requirements:
57
51
  - - ~>
58
- - !ruby/object:Gem::Version
59
- hash: 3
60
- segments:
61
- - 2
62
- - 0
63
- version: "2.0"
64
- requirement: *id003
52
+ - !ruby/object:Gem::Version
53
+ version: '3.0'
54
+ - !ruby/object:Gem::Dependency
55
+ name: rake
56
+ requirement: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
65
62
  type: :development
66
63
  prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ - !ruby/object:Gem::Dependency
67
71
  name: rspec
68
- - !ruby/object:Gem::Dependency
69
- version_requirements: &id004 !ruby/object:Gem::Requirement
72
+ requirement: !ruby/object:Gem::Requirement
70
73
  none: false
71
- requirements:
72
- - - ~>
73
- - !ruby/object:Gem::Version
74
- hash: 27
75
- segments:
76
- - 0
77
- - 8
78
- version: "0.8"
79
- requirement: *id004
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
80
78
  type: :development
81
79
  prerelease: false
82
- name: rake
83
- - !ruby/object:Gem::Dependency
84
- version_requirements: &id005 !ruby/object:Gem::Requirement
80
+ version_requirements: !ruby/object:Gem::Requirement
85
81
  none: false
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- hash: 3
90
- segments:
91
- - 0
92
- version: "0"
93
- requirement: *id005
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ - !ruby/object:Gem::Dependency
87
+ name: sqlite3
88
+ requirement: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
94
  type: :development
95
95
  prerelease: false
96
- name: sqlite3
96
+ version_requirements: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
97
102
  description: ActiveRecord backend for DelayedJob, originally authored by Tobias Luetke
98
- email:
103
+ email:
104
+ - bryckbost@gmail.com
99
105
  - matt@griffinonline.org
106
+ - sferik@gmail.com
100
107
  executables: []
101
-
102
108
  extensions: []
103
-
104
- extra_rdoc_files:
109
+ extra_rdoc_files:
105
110
  - README.md
106
- files:
111
+ files:
107
112
  - lib/delayed/backend/active_record.rb
108
113
  - lib/delayed_job_active_record.rb
109
114
  - lib/generators/delayed_job/active_record_generator.rb
@@ -118,41 +123,39 @@ files:
118
123
  - README.md
119
124
  homepage: http://github.com/collectiveidea/delayed_job_active_record
120
125
  licenses: []
121
-
122
126
  post_install_message:
123
- rdoc_options:
127
+ rdoc_options:
124
128
  - --main
125
129
  - README.md
126
130
  - --inline-source
127
131
  - --line-numbers
128
- require_paths:
132
+ require_paths:
129
133
  - lib
130
- required_ruby_version: !ruby/object:Gem::Requirement
134
+ required_ruby_version: !ruby/object:Gem::Requirement
131
135
  none: false
132
- requirements:
133
- - - ">="
134
- - !ruby/object:Gem::Version
135
- hash: 3
136
- segments:
136
+ requirements:
137
+ - - ! '>='
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ segments:
137
141
  - 0
138
- version: "0"
139
- required_rubygems_version: !ruby/object:Gem::Requirement
142
+ hash: -4543581460881455669
143
+ required_rubygems_version: !ruby/object:Gem::Requirement
140
144
  none: false
141
- requirements:
142
- - - ">="
143
- - !ruby/object:Gem::Version
144
- hash: 3
145
- segments:
145
+ requirements:
146
+ - - ! '>='
147
+ - !ruby/object:Gem::Version
148
+ version: '0'
149
+ segments:
146
150
  - 0
147
- version: "0"
151
+ hash: -4543581460881455669
148
152
  requirements: []
149
-
150
153
  rubyforge_project:
151
- rubygems_version: 1.8.10
154
+ rubygems_version: 1.8.23
152
155
  signing_key:
153
156
  specification_version: 3
154
157
  summary: ActiveRecord backend for DelayedJob
155
- test_files:
158
+ test_files:
156
159
  - spec/database.yml
157
160
  - spec/delayed/backend/active_record_spec.rb
158
161
  - spec/delayed/serialization/active_record_spec.rb