summaryrefslogtreecommitdiff
path: root/lib/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tasks')
-rw-r--r--lib/tasks/assets.rake6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/tasks/assets.rake b/lib/tasks/assets.rake
index 9d4b048..e778021 100644
--- a/lib/tasks/assets.rake
+++ b/lib/tasks/assets.rake
@@ -1,7 +1,9 @@
1namespace :assets do 1namespace :assets do
2 desc "Regenerate ImageMagick variants for every image asset from its stored original -- rerun whenever a new style is added to FileAttachment::STYLES after assets already exist. Scope to one asset first with ASSET_ID=123." 2 desc "Regenerate ImageMagick variants for every image asset from its stored original -- rerun whenever a new style is added to FileAttachment::STYLES after assets already exist. Scope to one asset first with ASSET_ID=123."
3 task :regenerate_variants => :environment do 3 task :regenerate_variants => :environment do
4 scope = Asset.images 4 scope = Asset.where(upload_content_type: FileAttachment::IMAGE_CONTENT_TYPES +
5 FileAttachment::VECTOR_CONTENT_TYPES +
6 FileAttachment::RASTERIZED_CONTENT_TYPES)
5 scope = scope.where(id: ENV["ASSET_ID"]) if ENV["ASSET_ID"].present? 7 scope = scope.where(id: ENV["ASSET_ID"]) if ENV["ASSET_ID"].present?
6 8
7 scope.find_each do |asset| 9 scope.find_each do |asset|
@@ -12,7 +14,7 @@ namespace :assets do
12 next 14 next
13 end 15 end
14 16
15 asset.send(:generate_variants, original_path) 17 asset.send(:generate_all_variants, original_path)
16 puts "Regenerated variants for Asset##{asset.id} (#{asset.name})" 18 puts "Regenerated variants for Asset##{asset.id} (#{asset.name})"
17 end 19 end
18 end 20 end