2012-11-14 15:48:20 +00:00
|
|
|
namespace :pull_requests do
|
|
|
|
|
|
|
|
desc 'Remove temporary git repos for pull requests'
|
|
|
|
task :clear => :environment do
|
2012-11-14 16:28:21 +00:00
|
|
|
Dir.chdir(File.join(APP_CONFIG['git_path'], 'temp_pull_requests')) do
|
2012-11-14 15:48:20 +00:00
|
|
|
say "Removing repos older one day:"
|
2012-11-14 17:15:44 +00:00
|
|
|
say `find -mindepth 3 -maxdepth 3 -type d -mtime +0`
|
|
|
|
`find -mindepth 3 -maxdepth 3 -type d -mtime +0 | xargs rm -rf`
|
2012-11-14 15:48:20 +00:00
|
|
|
say '-----'
|
|
|
|
say "Removing empty dir:"
|
2012-11-14 16:46:09 +00:00
|
|
|
say `find -maxdepth 2 -type d -empty`
|
|
|
|
`find -maxdepth 2 -type d -empty -delete`
|
2012-11-14 15:48:20 +00:00
|
|
|
say 'done!'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|