remove tmp file rake task/
This commit is contained in:
parent
cabceb0064
commit
d137e78f19
|
@ -1,12 +1,26 @@
|
||||||
desc "nyan ruby zip operation"
|
desc "nyan ruby zip operation"
|
||||||
task :zip do
|
task :zip do
|
||||||
puts "will building zip tmp files sweeper."
|
puts "input rake zip:clean_tmp will removed tmp/*.zip ."
|
||||||
end
|
end
|
||||||
|
|
||||||
namespace :zip do
|
namespace :zip do
|
||||||
desc "ruby zip sweeper"
|
desc "ruby zip sweeper"
|
||||||
task :rubyzip_clean do
|
task :clean_tmp do
|
||||||
puts "ruby zip sweeping..."
|
unless File.exist?(Dir.pwd+"/tmp/archiveZip")
|
||||||
|
puts "tmp/archiveZip folder is not exist. "
|
||||||
|
next
|
||||||
|
end
|
||||||
|
|
||||||
|
puts "ruby zip sweeping..."
|
||||||
|
Dir.chdir('tmp/archiveZip') do
|
||||||
|
Dir['*'].select do |file|
|
||||||
|
if file =~ /archive_\d+\.zip/
|
||||||
|
File.delete(file)
|
||||||
|
puts "#{file} is deleted."
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
puts "ruby zip sweeping is done."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue