adds rake task for repocess file thumbnails [fixes SCI-831]

This commit is contained in:
zmagod 2017-01-13 14:14:41 +01:00
parent f3b462bccb
commit f560a9999a

View file

@ -22,10 +22,26 @@ namespace :paperclip do
end
end
desc "List all paperclip files"
desc 'List all paperclip files'
task files: :environment do
print_model_files Asset, :file
print_model_files User, :avatar
end
desc 'Reprocess the Assets attachents styles'
task reprocess: :environment do
error = false
Asset.find_each(batch_size: 100) do |asset|
next unless asset.is_image?
begin
asset.file.reprocess! :medium, :large
rescue
error = true
$stderr.puts "exception while processing #{asset.file_file_name} " \
"ID: #{asset.id}:"
end
end
$stderr.puts 'All gone well! ' \
'You can grab a beer now and enjoy the evening.' unless error
end
end