jobbr 1.0.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/Gemfile.lock +78 -64
- data/README.rdoc +16 -2
- data/app/controllers/jobbr/delayed_jobs_controller.rb +1 -1
- data/app/controllers/jobbr/jobs_controller.rb +2 -1
- data/app/controllers/jobbr/runs_controller.rb +2 -2
- data/app/models/jobbr/delayed_job.rb +11 -0
- data/app/models/jobbr/job.rb +14 -0
- data/app/models/jobbr/run.rb +4 -1
- data/app/models/jobbr/scheduled_job.rb +14 -0
- data/app/views/jobbr/jobs/show.html.haml +1 -1
- data/config/locales/jobbr.en.yml +1 -1
- data/jobbr.gemspec +1 -0
- data/lib/generators/jobbr/heroku_scheduled_job/USAGE +8 -0
- data/lib/generators/jobbr/heroku_scheduled_job/heroku_scheduled_job_generator.rb +10 -0
- data/lib/generators/jobbr/heroku_scheduled_job/templates/heroku_scheduled_job.erb +15 -0
- data/lib/jobbr/engine.rb +2 -0
- data/lib/jobbr/version.rb +1 -1
- data/lib/tasks/jobbr_tasks.rake +27 -0
- data/spec/dummy/app/models/delayed_jobs/dummy_job.rb +1 -1
- data/spec/dummy/app/models/scheduled_jobs/dummy_heroku_job.rb +15 -0
- data/spec/models/scheduled_job_spec.rb +6 -1
- metadata +25 -4
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,8 +1,17 @@
|
|
1
|
+
GIT
|
2
|
+
remote: git://github.com/asavartsov/delayed_job_mongoid.git
|
3
|
+
revision: b4a040d82436ddc7e4a10715e739a50bee7b807a
|
4
|
+
specs:
|
5
|
+
delayed_job_mongoid (2.0.0)
|
6
|
+
delayed_job (~> 3.0)
|
7
|
+
mongoid (~> 3.0)
|
8
|
+
|
1
9
|
PATH
|
2
10
|
remote: .
|
3
11
|
specs:
|
4
|
-
jobbr (1.0
|
12
|
+
jobbr (1.1.0)
|
5
13
|
chronic_duration
|
14
|
+
delayed_job_mongoid
|
6
15
|
mongoid (~> 3.0)
|
7
16
|
rails (~> 3.2)
|
8
17
|
whenever
|
@@ -10,37 +19,37 @@ PATH
|
|
10
19
|
GEM
|
11
20
|
remote: http://rubygems.org/
|
12
21
|
specs:
|
13
|
-
actionmailer (3.2.
|
14
|
-
actionpack (= 3.2.
|
15
|
-
mail (~> 2.
|
16
|
-
actionpack (3.2.
|
17
|
-
activemodel (= 3.2.
|
18
|
-
activesupport (= 3.2.
|
22
|
+
actionmailer (3.2.13)
|
23
|
+
actionpack (= 3.2.13)
|
24
|
+
mail (~> 2.5.3)
|
25
|
+
actionpack (3.2.13)
|
26
|
+
activemodel (= 3.2.13)
|
27
|
+
activesupport (= 3.2.13)
|
19
28
|
builder (~> 3.0.0)
|
20
29
|
erubis (~> 2.7.0)
|
21
30
|
journey (~> 1.0.4)
|
22
|
-
rack (~> 1.4.
|
31
|
+
rack (~> 1.4.5)
|
23
32
|
rack-cache (~> 1.2)
|
24
33
|
rack-test (~> 0.6.1)
|
25
34
|
sprockets (~> 2.2.1)
|
26
|
-
activemodel (3.2.
|
27
|
-
activesupport (= 3.2.
|
35
|
+
activemodel (3.2.13)
|
36
|
+
activesupport (= 3.2.13)
|
28
37
|
builder (~> 3.0.0)
|
29
|
-
activerecord (3.2.
|
30
|
-
activemodel (= 3.2.
|
31
|
-
activesupport (= 3.2.
|
38
|
+
activerecord (3.2.13)
|
39
|
+
activemodel (= 3.2.13)
|
40
|
+
activesupport (= 3.2.13)
|
32
41
|
arel (~> 3.0.2)
|
33
42
|
tzinfo (~> 0.3.29)
|
34
|
-
activeresource (3.2.
|
35
|
-
activemodel (= 3.2.
|
36
|
-
activesupport (= 3.2.
|
37
|
-
activesupport (3.2.
|
38
|
-
i18n (
|
43
|
+
activeresource (3.2.13)
|
44
|
+
activemodel (= 3.2.13)
|
45
|
+
activesupport (= 3.2.13)
|
46
|
+
activesupport (3.2.13)
|
47
|
+
i18n (= 0.6.1)
|
39
48
|
multi_json (~> 1.0)
|
40
49
|
arel (3.0.2)
|
41
50
|
builder (3.0.4)
|
42
|
-
chronic (0.9.
|
43
|
-
chronic_duration (0.
|
51
|
+
chronic (0.9.1)
|
52
|
+
chronic_duration (0.10.2)
|
44
53
|
numerizer (~> 0.1.1)
|
45
54
|
coffee-rails (3.2.2)
|
46
55
|
coffee-script (>= 2.2.0)
|
@@ -48,39 +57,43 @@ GEM
|
|
48
57
|
coffee-script (2.2.0)
|
49
58
|
coffee-script-source
|
50
59
|
execjs
|
51
|
-
coffee-script-source (1.
|
60
|
+
coffee-script-source (1.6.3)
|
52
61
|
combustion (0.3.3)
|
53
62
|
rails (>= 3.0.0)
|
54
63
|
thor (>= 0.14.6)
|
55
|
-
database_cleaner (0.
|
56
|
-
|
64
|
+
database_cleaner (1.0.1)
|
65
|
+
delayed_job (3.0.5)
|
66
|
+
activesupport (~> 3.0)
|
67
|
+
diff-lcs (1.2.4)
|
57
68
|
erubis (2.7.0)
|
58
69
|
execjs (1.4.0)
|
59
70
|
multi_json (~> 1.0)
|
60
|
-
haml (
|
61
|
-
|
71
|
+
haml (4.0.3)
|
72
|
+
tilt
|
73
|
+
hike (1.2.3)
|
62
74
|
i18n (0.6.1)
|
63
75
|
journey (1.0.4)
|
64
|
-
jquery-rails (
|
76
|
+
jquery-rails (3.0.2)
|
65
77
|
railties (>= 3.0, < 5.0)
|
66
78
|
thor (>= 0.14, < 2.0)
|
67
|
-
json (1.
|
79
|
+
json (1.8.0)
|
68
80
|
kgio (2.8.0)
|
69
|
-
mail (2.
|
70
|
-
i18n (>= 0.4.0)
|
81
|
+
mail (2.5.4)
|
71
82
|
mime-types (~> 1.16)
|
72
83
|
treetop (~> 1.4.8)
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
84
|
+
metaclass (0.0.1)
|
85
|
+
mime-types (1.23)
|
86
|
+
mocha (0.14.0)
|
87
|
+
metaclass (~> 0.0.1)
|
88
|
+
mongoid (3.1.4)
|
89
|
+
activemodel (~> 3.2)
|
90
|
+
moped (~> 1.4)
|
78
91
|
origin (~> 1.0)
|
79
92
|
tzinfo (~> 0.3.22)
|
80
|
-
moped (1.
|
81
|
-
multi_json (1.
|
93
|
+
moped (1.5.0)
|
94
|
+
multi_json (1.7.7)
|
82
95
|
numerizer (0.1.1)
|
83
|
-
origin (1.0
|
96
|
+
origin (1.1.0)
|
84
97
|
polyglot (0.3.3)
|
85
98
|
rack (1.4.5)
|
86
99
|
rack-cache (1.2)
|
@@ -89,37 +102,37 @@ GEM
|
|
89
102
|
rack
|
90
103
|
rack-test (0.6.2)
|
91
104
|
rack (>= 1.0)
|
92
|
-
rails (3.2.
|
93
|
-
actionmailer (= 3.2.
|
94
|
-
actionpack (= 3.2.
|
95
|
-
activerecord (= 3.2.
|
96
|
-
activeresource (= 3.2.
|
97
|
-
activesupport (= 3.2.
|
105
|
+
rails (3.2.13)
|
106
|
+
actionmailer (= 3.2.13)
|
107
|
+
actionpack (= 3.2.13)
|
108
|
+
activerecord (= 3.2.13)
|
109
|
+
activeresource (= 3.2.13)
|
110
|
+
activesupport (= 3.2.13)
|
98
111
|
bundler (~> 1.0)
|
99
|
-
railties (= 3.2.
|
100
|
-
railties (3.2.
|
101
|
-
actionpack (= 3.2.
|
102
|
-
activesupport (= 3.2.
|
112
|
+
railties (= 3.2.13)
|
113
|
+
railties (3.2.13)
|
114
|
+
actionpack (= 3.2.13)
|
115
|
+
activesupport (= 3.2.13)
|
103
116
|
rack-ssl (~> 1.3.2)
|
104
117
|
rake (>= 0.8.7)
|
105
118
|
rdoc (~> 3.4)
|
106
119
|
thor (>= 0.14.6, < 2.0)
|
107
|
-
raindrops (0.
|
108
|
-
rake (10.0
|
109
|
-
rdoc (3.12.
|
120
|
+
raindrops (0.11.0)
|
121
|
+
rake (10.1.0)
|
122
|
+
rdoc (3.12.2)
|
110
123
|
json (~> 1.4)
|
111
|
-
rspec-core (2.
|
112
|
-
rspec-expectations (2.
|
113
|
-
diff-lcs (
|
114
|
-
rspec-mocks (2.
|
115
|
-
rspec-rails (2.
|
124
|
+
rspec-core (2.14.1)
|
125
|
+
rspec-expectations (2.14.0)
|
126
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
127
|
+
rspec-mocks (2.14.1)
|
128
|
+
rspec-rails (2.14.0)
|
116
129
|
actionpack (>= 3.0)
|
117
130
|
activesupport (>= 3.0)
|
118
131
|
railties (>= 3.0)
|
119
|
-
rspec-core (~> 2.
|
120
|
-
rspec-expectations (~> 2.
|
121
|
-
rspec-mocks (~> 2.
|
122
|
-
sass (3.2.
|
132
|
+
rspec-core (~> 2.14.0)
|
133
|
+
rspec-expectations (~> 2.14.0)
|
134
|
+
rspec-mocks (~> 2.14.0)
|
135
|
+
sass (3.2.9)
|
123
136
|
sass-rails (3.2.6)
|
124
137
|
railties (~> 3.2.0)
|
125
138
|
sass (>= 3.1.10)
|
@@ -130,13 +143,13 @@ GEM
|
|
130
143
|
rack (~> 1.0)
|
131
144
|
tilt (~> 1.1, != 1.3.0)
|
132
145
|
sqlite3 (1.3.7)
|
133
|
-
thor (0.
|
134
|
-
tilt (1.
|
135
|
-
treetop (1.4.
|
146
|
+
thor (0.18.1)
|
147
|
+
tilt (1.4.1)
|
148
|
+
treetop (1.4.14)
|
136
149
|
polyglot
|
137
150
|
polyglot (>= 0.3.1)
|
138
|
-
tzinfo (0.3.
|
139
|
-
unicorn (4.
|
151
|
+
tzinfo (0.3.37)
|
152
|
+
unicorn (4.6.3)
|
140
153
|
kgio (~> 2.6)
|
141
154
|
rack
|
142
155
|
raindrops (~> 0.7)
|
@@ -152,6 +165,7 @@ DEPENDENCIES
|
|
152
165
|
coffee-rails
|
153
166
|
combustion (~> 0.3.1)
|
154
167
|
database_cleaner
|
168
|
+
delayed_job_mongoid!
|
155
169
|
haml
|
156
170
|
jobbr!
|
157
171
|
jquery-rails
|
data/README.rdoc
CHANGED
@@ -36,7 +36,7 @@ Use provided generators to create a first scheduled job
|
|
36
36
|
|
37
37
|
$> rails g jobbr:scheduled_job dummy
|
38
38
|
|
39
|
-
It will create a namespaced model as a well as a Whenever configuration file.
|
39
|
+
It will create a namespaced model as a well as a Whenever configuration file.
|
40
40
|
|
41
41
|
Provided you fill in description and scheduling attributes in the model, you will be able to see it in rake tasks:
|
42
42
|
|
@@ -48,6 +48,20 @@ And to see it in your crontab preview:
|
|
48
48
|
$> whenever
|
49
49
|
30 5 * * * /bin/bash -l -c 'cd /Users/cblavier/code/my_app && RAILS_ENV=production bundle exec rake jobbr:dummy_job >> /Users/cblavier/code/my_app/log/cron.log 2>&1'
|
50
50
|
|
51
|
+
=== Heroku Scheduled Jobs
|
52
|
+
|
53
|
+
You can also use Heroku Scheduler to run jobs. Unfortunately Heroku does not provide Cron-scheduling, but let you run jobs every 10 minutes, every hour or every day.
|
54
|
+
|
55
|
+
Jobbr provides you with 3 tasks `jobbr:heroku:minutely`, `jobbr:heroku:hourly` and `jobbr:heroku:daily`, that will run any ScheduledJob with `heroku_run` directive.
|
56
|
+
|
57
|
+
Run following generator to create an heroku scheduled job
|
58
|
+
|
59
|
+
$> rails g jobbr:heroku_scheduled_job dummy_heroku
|
60
|
+
|
61
|
+
Then you will need to manually add jobs to the Heroku scheduler console
|
62
|
+
|
63
|
+
{<img src="http://cl.ly/image/2N1T1l1w2c28/Capture%20d%E2%80%99%C3%A9cran%202013-07-09%20%C3%A0%2022.18.40.png" width='400'>}[http://cl.ly/image/2N1T1l1w2c28]
|
64
|
+
|
51
65
|
=== Delayed Jobs
|
52
66
|
|
53
67
|
Use generators to get a new job model:
|
@@ -67,7 +81,7 @@ You can now run your delayed job as following:
|
|
67
81
|
run_id = DelayedJobs::DummyJob.run_delayed(some_param: 37)
|
68
82
|
|
69
83
|
And then get job status like this:
|
70
|
-
|
84
|
+
|
71
85
|
Jobbr::Run.find(run_id).status # returns :waiting / :running / :failure / :success
|
72
86
|
|
73
87
|
Jobbr also provides a controller to run and poll delayed_jobs :
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Jobbr
|
2
2
|
|
3
|
-
class JobsController < ApplicationController
|
3
|
+
class JobsController < Jobbr::ApplicationController
|
4
4
|
|
5
5
|
def index
|
6
6
|
@scheduled_jobs = Jobbr::ScheduledJob.all
|
@@ -10,6 +10,7 @@ module Jobbr
|
|
10
10
|
def show
|
11
11
|
@job = Job.by_name(params[:id]).first
|
12
12
|
@runs = Run.for_job(@job)
|
13
|
+
@last_run = Run.unscoped.for_job(@job).first
|
13
14
|
end
|
14
15
|
|
15
16
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module Jobbr
|
2
2
|
|
3
|
-
class RunsController < ApplicationController
|
3
|
+
class RunsController < Jobbr::ApplicationController
|
4
4
|
|
5
5
|
def show
|
6
6
|
@job = Job.by_name(params[:job_id]).first
|
7
|
-
@run = @job.runs.where(id: params[:id]).first
|
7
|
+
@run = @job.runs.unscoped.where(id: params[:id]).first
|
8
8
|
end
|
9
9
|
|
10
10
|
end
|
@@ -12,6 +12,7 @@ module Jobbr
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.run_delayed(params, delayed = true)
|
15
|
+
delayed = delayed && !Rails.env.test?
|
15
16
|
job = instance
|
16
17
|
job_run = Run.create(status: :waiting, started_at: Time.now, job: job)
|
17
18
|
if delayed
|
@@ -23,6 +24,7 @@ module Jobbr
|
|
23
24
|
end
|
24
25
|
|
25
26
|
def self.run_delayed_by_name(job_class_name, params, delayed = true)
|
27
|
+
delayed = delayed && !Rails.env.test?
|
26
28
|
job = instance(job_class_name)
|
27
29
|
job_run = Run.create(status: :waiting, started_at: Time.now, job: job)
|
28
30
|
if delayed
|
@@ -33,6 +35,15 @@ module Jobbr
|
|
33
35
|
job_run
|
34
36
|
end
|
35
37
|
|
38
|
+
## Delayed Job callbacks
|
39
|
+
def error(job, exception)
|
40
|
+
puts 'JOBBR ERROR'
|
41
|
+
end
|
42
|
+
|
43
|
+
def failure
|
44
|
+
puts 'JOBBR FAILURE'
|
45
|
+
end
|
46
|
+
|
36
47
|
end
|
37
48
|
|
38
49
|
end
|
data/app/models/jobbr/job.rb
CHANGED
@@ -34,6 +34,7 @@ module Jobbr
|
|
34
34
|
def run(job_run = nil, params = {})
|
35
35
|
if job_run
|
36
36
|
job_run.status = :running
|
37
|
+
job_run.started_at = Time.now
|
37
38
|
job_run.save!
|
38
39
|
else
|
39
40
|
job_run = Run.create(status: :running, started_at: Time.now, job: self)
|
@@ -50,6 +51,9 @@ module Jobbr
|
|
50
51
|
old_logger = Rails.logger
|
51
52
|
Rails.logger = Jobbr::Logger.new(Rails.logger, job_run)
|
52
53
|
|
54
|
+
handle_process_interruption(job_run, 'TERM')
|
55
|
+
handle_process_interruption(job_run, 'INT')
|
56
|
+
|
53
57
|
begin
|
54
58
|
if self.delayed?
|
55
59
|
perform(params, job_run)
|
@@ -57,6 +61,7 @@ module Jobbr
|
|
57
61
|
perform
|
58
62
|
end
|
59
63
|
job_run.status = :success
|
64
|
+
job_run.write_attribute(:progress, 100)
|
60
65
|
rescue Exception => e
|
61
66
|
job_run.status = :failure
|
62
67
|
logger.error(e.message)
|
@@ -69,6 +74,15 @@ module Jobbr
|
|
69
74
|
end
|
70
75
|
end
|
71
76
|
|
77
|
+
def handle_process_interruption(job_run, signal)
|
78
|
+
Signal.trap(signal) do
|
79
|
+
job_run.status = :failure
|
80
|
+
Rails.logger.error("Job interrupted by a #{signal} signal")
|
81
|
+
job_run.finished_at = Time.now
|
82
|
+
job_run.save!
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
72
86
|
def last_run
|
73
87
|
@last_run ||= Run.for_job(self).first
|
74
88
|
end
|
data/app/models/jobbr/run.rb
CHANGED
@@ -14,9 +14,12 @@ module Jobbr
|
|
14
14
|
belongs_to :job
|
15
15
|
embeds_many :log_messages, class_name: 'Jobbr::LogMessage'
|
16
16
|
|
17
|
+
index(job_id: 1)
|
17
18
|
index(job_id: 1, started_at: -1)
|
18
19
|
|
19
|
-
scope :for_job, ->(job) { Run.where(job_id: job.id).order_by(started_at: -1) }
|
20
|
+
scope :for_job, ->(job) { Jobbr::Run.where(job_id: job.id).order_by(started_at: -1) }
|
21
|
+
|
22
|
+
default_scope -> { without(:log_messages)}
|
20
23
|
|
21
24
|
def run_time
|
22
25
|
@run_time ||= if finished_at && started_at
|
@@ -15,6 +15,20 @@ module Jobbr
|
|
15
15
|
@every
|
16
16
|
end
|
17
17
|
|
18
|
+
# heroku frequency can be :minutely, :hourly or :daily
|
19
|
+
def self.heroku_run(frequency, options = {})
|
20
|
+
@heroku_frequency = frequency
|
21
|
+
@heroku_priority = options[:priority] || 0
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.heroku_frequency
|
25
|
+
@heroku_frequency
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.heroku_priority
|
29
|
+
@heroku_priority
|
30
|
+
end
|
31
|
+
|
18
32
|
def self.task_name(with_namespace = false)
|
19
33
|
task_name = name.demodulize.underscore
|
20
34
|
if with_namespace
|
@@ -9,7 +9,7 @@
|
|
9
9
|
%p= raw t('.scheduling', scheduling: display_scheduling(@job))
|
10
10
|
= raw t('.average_run_time', run_time: ChronicDuration.output(@job.average_run_time, format: :long))
|
11
11
|
|
12
|
-
= render 'jobbr/runs/logs', run: @
|
12
|
+
= render 'jobbr/runs/logs', run: @last_run, title: t('.last_run_logs'), size: 'small'
|
13
13
|
|
14
14
|
%table.table.table-striped.table-hover
|
15
15
|
%thead
|
data/config/locales/jobbr.en.yml
CHANGED
data/jobbr.gemspec
CHANGED
@@ -0,0 +1,10 @@
|
|
1
|
+
class Jobbr::HerokuScheduledJobGenerator < Rails::Generators::NamedBase
|
2
|
+
|
3
|
+
source_root File.expand_path('../templates', __FILE__)
|
4
|
+
|
5
|
+
def create_scheduled_job
|
6
|
+
empty_directory "app/models/scheduled_jobs"
|
7
|
+
template "heroku_scheduled_job.erb", "app/models/scheduled_jobs/#{file_name}_job.rb", name: file_name
|
8
|
+
end
|
9
|
+
|
10
|
+
end
|
data/lib/jobbr/engine.rb
CHANGED
data/lib/jobbr/version.rb
CHANGED
data/lib/tasks/jobbr_tasks.rake
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
models_root = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'app', 'models'))
|
2
2
|
require File.join(models_root, 'jobbr', 'standalone_tasks')
|
3
|
+
require "jobbr/mongoid.rb"
|
3
4
|
|
4
5
|
namespace :jobbr do
|
5
6
|
|
@@ -11,4 +12,30 @@ namespace :jobbr do
|
|
11
12
|
info[:klass_name].constantize.run
|
12
13
|
end
|
13
14
|
end
|
15
|
+
|
16
|
+
desc 'Mark all running job as failed.'
|
17
|
+
task :sweep_running_jobs => :environment do
|
18
|
+
Jobbr::Run.where(status: :running).update_all(status: :failure)
|
19
|
+
end
|
20
|
+
|
21
|
+
namespace :heroku do
|
22
|
+
|
23
|
+
task :minutely => :environment do
|
24
|
+
heroku_scheduled_classes(:minutely).each(&:run)
|
25
|
+
end
|
26
|
+
|
27
|
+
task :hourly => :environment do
|
28
|
+
heroku_scheduled_classes(:hourly).each(&:run)
|
29
|
+
end
|
30
|
+
|
31
|
+
task :daily => :environment do
|
32
|
+
heroku_scheduled_classes(:daily).each(&:run)
|
33
|
+
end
|
34
|
+
|
35
|
+
def heroku_scheduled_classes(frequency)
|
36
|
+
Jobbr::Mongoid.models(Jobbr::ScheduledJob).select{|c| c.heroku_frequency == frequency }.sort{|a,b| b.heroku_priority <=> a.heroku_priority}
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
14
41
|
end
|
@@ -74,6 +74,11 @@ module Jobbr
|
|
74
74
|
job_run.finished_at.should_not be_nil
|
75
75
|
end
|
76
76
|
|
77
|
+
it 'sets the progress to 100% at the end' do
|
78
|
+
TestJob.run
|
79
|
+
TestJob.last.runs.last.progress.should be 100
|
80
|
+
end
|
81
|
+
|
77
82
|
it 'creates log messages when logging' do
|
78
83
|
class LoggingJob < ScheduledJob
|
79
84
|
def perform
|
@@ -83,7 +88,7 @@ module Jobbr
|
|
83
88
|
end
|
84
89
|
|
85
90
|
LoggingJob.run
|
86
|
-
last_job_run = ScheduledJob.last.runs.last
|
91
|
+
last_job_run = ScheduledJob.last.runs.unscoped.last
|
87
92
|
last_job_run.should have(2).log_messages
|
88
93
|
last_job_run.log_messages.first.kind.should be :debug
|
89
94
|
last_job_run.log_messages.first.message.should == 'foo'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jobbr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-07-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -43,6 +43,22 @@ dependencies:
|
|
43
43
|
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '3.0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: delayed_job_mongoid
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
46
62
|
- !ruby/object:Gem::Dependency
|
47
63
|
name: whenever
|
48
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -149,6 +165,9 @@ files:
|
|
149
165
|
- lib/generators/jobbr/delayed_job/USAGE
|
150
166
|
- lib/generators/jobbr/delayed_job/delayed_job_generator.rb
|
151
167
|
- lib/generators/jobbr/delayed_job/templates/delayed_job.erb
|
168
|
+
- lib/generators/jobbr/heroku_scheduled_job/USAGE
|
169
|
+
- lib/generators/jobbr/heroku_scheduled_job/heroku_scheduled_job_generator.rb
|
170
|
+
- lib/generators/jobbr/heroku_scheduled_job/templates/heroku_scheduled_job.erb
|
152
171
|
- lib/generators/jobbr/scheduled_job/USAGE
|
153
172
|
- lib/generators/jobbr/scheduled_job/scheduled_job_generator.rb
|
154
173
|
- lib/generators/jobbr/scheduled_job/templates/scheduled_job.erb
|
@@ -173,6 +192,7 @@ files:
|
|
173
192
|
- spec/dummy/app/mailers/.gitkeep
|
174
193
|
- spec/dummy/app/models/.gitkeep
|
175
194
|
- spec/dummy/app/models/delayed_jobs/dummy_job.rb
|
195
|
+
- spec/dummy/app/models/scheduled_jobs/dummy_heroku_job.rb
|
176
196
|
- spec/dummy/app/models/scheduled_jobs/dummy_job.rb
|
177
197
|
- spec/dummy/app/models/scheduled_jobs/dummy_scheduled_job.rb
|
178
198
|
- spec/dummy/app/views/home/index.html.haml
|
@@ -230,7 +250,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
230
250
|
version: '0'
|
231
251
|
segments:
|
232
252
|
- 0
|
233
|
-
hash:
|
253
|
+
hash: 1087904321549229692
|
234
254
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
235
255
|
none: false
|
236
256
|
requirements:
|
@@ -239,7 +259,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
239
259
|
version: '0'
|
240
260
|
segments:
|
241
261
|
- 0
|
242
|
-
hash:
|
262
|
+
hash: 1087904321549229692
|
243
263
|
requirements: []
|
244
264
|
rubyforge_project:
|
245
265
|
rubygems_version: 1.8.23
|
@@ -257,6 +277,7 @@ test_files:
|
|
257
277
|
- spec/dummy/app/mailers/.gitkeep
|
258
278
|
- spec/dummy/app/models/.gitkeep
|
259
279
|
- spec/dummy/app/models/delayed_jobs/dummy_job.rb
|
280
|
+
- spec/dummy/app/models/scheduled_jobs/dummy_heroku_job.rb
|
260
281
|
- spec/dummy/app/models/scheduled_jobs/dummy_job.rb
|
261
282
|
- spec/dummy/app/models/scheduled_jobs/dummy_scheduled_job.rb
|
262
283
|
- spec/dummy/app/views/home/index.html.haml
|