-
Notifications
You must be signed in to change notification settings - Fork 14
/
Rakefile
48 lines (41 loc) · 943 Bytes
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
$stdout.sync = true
$: << File.join(File.dirname(__FILE__), './lib')
begin
require 'rspec/core/rake_task'
desc 'Run Rspec unit tests'
RSpec::Core::RakeTask.new(:spec) do |t|
t.pattern = 'spec/**/*_spec.rb'
end
task default: :spec
rescue LoadError
end
def require_jobfiles(args)
require 'pushpop'
if jobfile = args[:jobfile]
load "#{File.dirname(__FILE__)}/#{jobfile}"
else
Dir.glob("#{File.dirname(__FILE__)}/jobs/**/*.rb").each { |file|
require file
}
end
end
namespace :jobs do
desc 'Describe jobs'
task :describe, :jobfile do |_, args|
require_jobfiles(args)
Pushpop.jobs.each do |job|
puts job.name
end
end
desc 'Run each job once'
task :run_once, :jobfile do |_, args|
require_jobfiles(args)
Pushpop.run
end
desc 'Run jobs ongoing'
task :run, :jobfile do |_, args|
require_jobfiles(args)
Pushpop.schedule
Clockwork.manager.run
end
end