提供手工打包zip的命令

This commit is contained in:
guange 2017-01-06 10:27:41 +08:00
parent 1ff6372d61
commit db707dd408
1 changed files with 16 additions and 0 deletions

16
lib/tasks/zip.rake Normal file
View File

@ -0,0 +1,16 @@
#coding=utf-8
namespace :zip do
desc "手工打包作品"
task :pack => :environment do
homework = HomeworkCommon.find ENV["ID"]
file_count = 0
homework.student_works.map { |work| file_count += work.attachments.count}
if file_count > 0
zipfile = zip_homework_common homework
else
zipfile = {:message => "no file"}
end
puts "out: #{zipfile}"
end
end