Sha256: ddc8410ebd834b9ce8e48880d6680c72c7d03116433b486c8771778e5926d2bb
Contents?: true
Size: 561 Bytes
Versions: 10
Compression:
Stored size: 561 Bytes
Contents
namespace :sufia do desc "Reports on and optionally removes empty batches that contain no associated files" task :empty_batches, [:remove] => :environment do |t, args| option = args.to_hash.fetch(:remove, "keep") Batch.all.each do |batch| if batch.generic_files.empty? print "#{batch.id} contains no files - " if option == "remove" batch.destroy puts "deleted" else puts "to delete, rerun with the remove option: rake sufia:empty_batches[remove]" end end end end end
Version data entries
10 entries across 10 versions & 2 rubygems