Commit a9553332 by Michael Reinsch Committed by Jon Yurek

print errors right away, don't let the user wait

parent cb7ad7bd
...@@ -26,17 +26,17 @@ namespace :paperclip do ...@@ -26,17 +26,17 @@ namespace :paperclip do
namespace :refresh do namespace :refresh do
desc "Regenerates thumbnails for a given CLASS (and optional ATTACHMENT and STYLES splitted by comma)." desc "Regenerates thumbnails for a given CLASS (and optional ATTACHMENT and STYLES splitted by comma)."
task :thumbnails => :environment do task :thumbnails => :environment do
errors = []
klass = Paperclip::Task.obtain_class klass = Paperclip::Task.obtain_class
names = Paperclip::Task.obtain_attachments(klass) names = Paperclip::Task.obtain_attachments(klass)
styles = (ENV['STYLES'] || ENV['styles'] || '').split(',').map(&:to_sym) styles = (ENV['STYLES'] || ENV['styles'] || '').split(',').map(&:to_sym)
names.each do |name| names.each do |name|
Paperclip.each_instance_with_attachment(klass, name) do |instance| Paperclip.each_instance_with_attachment(klass, name) do |instance|
instance.send(name).reprocess!(*styles) instance.send(name).reprocess!(*styles)
errors << [instance.id, instance.errors] unless instance.errors.blank? unless instance.errors.blank?
puts "#{instance.id}: #{instance.errors.full_messages.inspect}"
end
end end
end end
errors.each{|e| puts "#{e.first}: #{e.last.full_messages.inspect}" }
end end
desc "Regenerates content_type/size metadata for a given CLASS (and optional ATTACHMENT)." desc "Regenerates content_type/size metadata for a given CLASS (and optional ATTACHMENT)."
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment