09110d107c
The primary license of the project is changing to: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later with some specific files to be licensed under the one of two licenses: CC0-1.0 LGPL-3.0-or-later This commit is one of the many steps to relicense the entire codebase. Documentation granting permission for this relicensing (from all past contributors who hold copyrights) is on file with Software Freedom Conservancy, Inc.
25 lines
806 B
Ruby
25 lines
806 B
Ruby
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
|
|
require 'scheduled_jobs'
|
|
|
|
desc "For use with Heroku's Scheduler add-on"
|
|
|
|
# We use a single rake call so we can catch and send any errors that happen in the job
|
|
task :heroku_scheduled_job, [:name] => :environment do |t, args|
|
|
job_name = args[:name]
|
|
# Fetch all the super admin emails so we can send a report
|
|
enum = ScheduledJobs.send(job_name)
|
|
|
|
results = ""
|
|
enum.each do |lamb|
|
|
begin
|
|
result = lamb.call
|
|
results += "Success: #{result}\n"
|
|
rescue Exception => e
|
|
results += "Failure: #{e}\n"
|
|
end
|
|
end
|
|
GenericMailer.delay.admin_notice({
|
|
subject: "Scheduled job results on CommitChange for '#{job_name}'",
|
|
body: results.empty? ? "No jobs to run today." : results
|
|
})
|
|
end
|