mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 16:01:20 +08:00
FEATURE: Merge discourse-automation (#26432)
Automation (previously known as discourse-automation) is now a core plugin.
This commit is contained in:
19
plugins/automation/lib/tasks/automation.rake
Normal file
19
plugins/automation/lib/tasks/automation.rake
Normal file
@ -0,0 +1,19 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
task "run_automation" => :environment do
|
||||
script_methods = DiscourseAutomation::Scriptable.all
|
||||
|
||||
scripts = []
|
||||
|
||||
DiscourseAutomation::Automation.find_each do |automation|
|
||||
script_methods.each do |name|
|
||||
type = name.to_s.gsub("script_", "")
|
||||
|
||||
next if type != automation.script
|
||||
|
||||
scriptable = automation.scriptable
|
||||
scriptable.public_send(name)
|
||||
scripts << scriptable.script.call
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user