[refs #90] avoid collisions with temporary repos
This commit is contained in:
parent
b21046ba50
commit
56e9174045
|
@ -84,8 +84,8 @@ class PullRequest < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def path
|
def path
|
||||||
filename = [id, from_project_owner_uname, from_project_name].compact.join('-')
|
last_part = [id, from_project_owner_uname, from_project_name].compact.join('-')
|
||||||
File.join(APP_CONFIG['git_path'], 'pull_requests', new_record? ? 'tmp' : '', to_project.owner.uname, to_project.name, filename)
|
File.join(APP_CONFIG['git_path'], "#{new_record? ? 'temp_' : ''}pull_requests", to_project.owner.uname, to_project.name, last_part)
|
||||||
end
|
end
|
||||||
|
|
||||||
def from_branch
|
def from_branch
|
||||||
|
|
|
@ -2,7 +2,7 @@ namespace :pull_requests do
|
||||||
|
|
||||||
desc 'Remove temporary git repos for pull requests'
|
desc 'Remove temporary git repos for pull requests'
|
||||||
task :clear => :environment do
|
task :clear => :environment do
|
||||||
Dir.chdir(File.join(APP_CONFIG['git_path'], 'pull_requests', 'tmp')) do
|
Dir.chdir(File.join(APP_CONFIG['git_path'], 'temp_pull_requests')) do
|
||||||
say "Removing repos older one day:"
|
say "Removing repos older one day:"
|
||||||
say `find -mindepth 2 -maxdepth 2 -type d -mtime +0`
|
say `find -mindepth 2 -maxdepth 2 -type d -mtime +0`
|
||||||
`find -mindepth 2 -maxdepth 2 -type d -mtime +0 | xargs rm -rf`
|
`find -mindepth 2 -maxdepth 2 -type d -mtime +0 | xargs rm -rf`
|
||||||
|
|
Loading…
Reference in New Issue