[refs #90] clean old temporary git
This commit is contained in:
parent
1afcef17c3
commit
b21046ba50
|
@ -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
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue