You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
802 B
38 lines
802 B
desc "nyan ruby zip operation"
|
|
task :zip do
|
|
puts "input rake zip:clean_tmp will removed tmp/*.zip ."
|
|
end
|
|
|
|
namespace :zip do
|
|
desc "ruby zip sweeper"
|
|
task :clean_tmp do
|
|
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
|
|
|
|
desc "create tmp file, to test"
|
|
file 'tmp/test.yml' do
|
|
require 'yaml'
|
|
var = {
|
|
:name => "name",
|
|
:age => "age",
|
|
:agent => "agent"
|
|
}
|
|
File.open('tmp/test.yml', 'w') do |f|
|
|
f.write YAML.dump({'conf' => var })
|
|
end
|
|
end |