diff --git a/lib/tasks/shixun_rep.rake b/lib/tasks/shixun_rep.rake index d7a2d01b1..0d5f0e82a 100644 --- a/lib/tasks/shixun_rep.rake +++ b/lib/tasks/shixun_rep.rake @@ -1,5 +1,6 @@ # 针对某个企业,如果课程版本库丢失,可以执行命令一键同步企业版本库 require GitService +include GitHelper namespace :shixun_sync do task :repo => :environment do @@ -7,8 +8,10 @@ namespace :shixun_sync do subject = Subject.find_by(subject_id) subject.shixuns.try(:each) do |shixun| username = shixun.owner.try(:login) - new_repo_name = "#{username.try(:strip)}/#{shixun.try(:identifier)}#{ Time.now.strftime("%Y%m%d%H%M%S")}" - GitService.fork_repository(repo_path: "#{shixun.try(:repo_name)}.git", fork_repository_path: (new_repo_name + ".git")) + # new_repo_name = "#{username.try(:strip)}/#{shixun.try(:identifier)}#{ Time.now.strftime("%Y%m%d%H%M%S")}" + # GitService.fork_repository(repo_path: "#{shixun.try(:repo_name)}.git", fork_repository_path: (new_repo_name + ".git")) + + project_fork(shixun, "#{shixun.try(:repo_name)}.git", username) end end end \ No newline at end of file