[refs #90] clean old temporary git

This commit is contained in:
Alexander Machehin 2012-11-14 21:48:20 +06:00
parent 1afcef17c3
commit b21046ba50
2 changed files with 20 additions and 0 deletions

View File

@ -14,3 +14,7 @@ end
every 1.day, :at => '3:50 am' do
rake "buildlist:clear:outdated", :output => 'log/build_list_clear.log'
end
every 1.day, :at => '3:30 am' do
rake "pull_requests:clear", :output => 'log/pull_requests_clear.log'
end

View File

@ -0,0 +1,16 @@
namespace :pull_requests do
desc 'Remove temporary git repos for pull requests'
task :clear => :environment do
Dir.chdir(File.join(APP_CONFIG['git_path'], 'pull_requests', 'tmp')) do
say "Removing repos older one day:"
say `find -mindepth 2 -maxdepth 2 -type d -mtime +0`
`find -mindepth 2 -maxdepth 2 -type d -mtime +0 | xargs rm -rf`
say '-----'
say "Removing empty dir:"
say `find -mindepth 2 -maxdepth 2 -type d -empty`
`find -mindepth 2 -maxdepth 2 -type d -empty -delete`
say 'done!'
end
end
end