Skip to content

A platform for community discussion. Free, open, simple.

DEV: Add an option to skip a theme update from the themes:install task. (#12905)

Jeff Wong656b0ae39e00
diff --git a/app/services/themes_install_task.rb b/app/services/themes_install_task.rb
index 3fae7a9ff79..ac32739a1bf 100644
--- a/app/services/themes_install_task.rb
+++ b/app/services/themes_install_task.rb
@@ -2,14 +2,17 @@
class ThemesInstallTask
def self.install(themes)
- counts = { installed: 0, updated: 0, errors: 0 }
+ counts = { installed: 0, updated: 0, errors: 0, skipped: 0 }
log = []
themes.each do |name, val|
installer = new(val)
next if installer.url.nil?
if installer.theme_exists?
- if installer.update
+ if installer.options.fetch(:skip_update, nil)
+ log << "#{name}: is already installed. Skipping update."
+ counts[:skipped] += 1
+ elsif installer.update
log << "#{name}: is already installed. Updating from remote."
counts[:updated] += 1
else
diff --git a/lib/tasks/themes.rake b/lib/tasks/themes.rake
index 8bd3e101033..2de8b30a5a9 100644
--- a/lib/tasks/themes.rake
+++ b/lib/tasks/themes.rake
@@ -45,6 +45,7 @@ task "themes:install" => :environment do |task, args|
puts " Installed: #{counts[:installed]}"
puts " Updated: #{counts[:updated]}"
puts " Errors: #{counts[:errors]}"
+ puts " Skipped: #{counts[:skipped]}"
if counts[:errors] > 0
exit 1