mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-06 06:56:54 +08:00
Merge pull request #407 from ZmagoD/zd_SCI_831
adds rake task for repocess file thumbnails [fixes SCI-831]
This commit is contained in:
commit
0520690e8d
1 changed files with 19 additions and 1 deletions
|
@ -22,10 +22,28 @@ 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
|
||||
unless error
|
||||
$stderr.puts 'All gone well! ' \
|
||||
'You can grab a beer now and enjoy the evening.'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue