FEATURE: Add auto update field to themes (#11102)

Themes marked for auto update will be automatically updated when
Discourse is updated. This is triggered by discourse_docker or
docker_manager running Rake task 'themes:update'.
This commit is contained in:
Dan Ungureanu
2020-11-16 14:44:09 +02:00
committed by GitHub
parent 0853208d67
commit bc8423a1bf
8 changed files with 48 additions and 7 deletions

View File

@ -51,6 +51,22 @@ task "themes:install" => :environment do |task, args|
end
end
desc "Update themes & theme components"
task "themes:update" => :environment do |task, args|
Theme.where(auto_update: true).find_each do |theme|
begin
if theme.remote_theme.present?
puts "Updating #{theme.name}..."
theme.remote_theme.update_from_remote
end
rescue => e
STDERR.puts "Failed to update #{theme.name}"
STDERR.puts e
STDERR.puts e.backtrace
end
end
end
desc "List all the installed themes on the site"
task "themes:audit" => :environment do
components = Set.new