Adds rake
and cap
tasks for loading Sidekiq::Cron::Job
s from a config
file.
You can run the rake task via:
bundle exec rake sidekiq_cron:load
It expects a configuration file at config/sidekiq_cron.yml
in this format:
default: &defaults
rake task does stuff:
cron: "42 0 * * *"
class: "RakeTaskJob"
args:
- does:stuff
development:
<<: *defaults
staging:
<<: *defaults
production:
<<: *defaults
You can configure the location of this file, as well as name prefixes for tasks:
Sidekiq::Cron::Tasks.configure do |config|
config.file = "/custom/file/path"
config.prefix = "notmyprefix"
end
You can enable this task for Capistrano deployment. It runs around the same time that Rails' db migrations do. To enable it:
# Capfile
require 'capistrano/sidekiq-cron'
Add this line to your application's Gemfile:
gem 'sidekiq-cron-tasks'
And then execute:
$ bundle
Or install it yourself as:
$ gem install sidekiq-cron-tasks
Contribution directions go here.
The gem is available as open source under the terms of the MIT License.