parent
59de2cd1fa
commit
f1c69deb06
@ -0,0 +1,14 @@
|
|||||||
|
# 针对某个企业,如果课程版本库丢失,可以执行命令一键同步企业版本库
|
||||||
|
require GitService
|
||||||
|
|
||||||
|
namespace :shixun_sync do
|
||||||
|
task :repo => :environment do
|
||||||
|
subject_id = ENV['args'].split(",")[0].to_i # 课程id
|
||||||
|
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"))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in new issue