You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
795 B
22 lines
795 B
# 针对某个企业,如果课程版本库丢失,可以执行命令一键同步企业版本库
|
|
|
|
|
|
namespace :shixun_sync do
|
|
task :repo => :environment do
|
|
# require GitService
|
|
include GitHelper
|
|
include LoggerHelper
|
|
|
|
subject_id = ENV['args'].to_s # 课程id
|
|
puts subject_id
|
|
subject = Subject.find_by(id: 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"))
|
|
|
|
puts "#############{shixun.id}"
|
|
project_fork(shixun, "#{shixun.try(:repo_name)}.git", username)
|
|
end
|
|
end
|
|
end |