Browse Source

修改同步的报错

tags/v1
sylor_huang@126.com 6 years ago
parent
commit
f9b871f039
1 changed files with 7 additions and 4 deletions
  1. +7
    -4
      lib/tasks/sync_forge_gitea.rake

+ 7
- 4
lib/tasks/sync_forge_gitea.rake View File

@@ -10,7 +10,7 @@ namespace :sync_forge_gitea do
all_repositories.find_each do |r|
project = r.project
user = project.owner
unless r.url.to_s.include?("http://gitea.trustie.net")
unless r.url.to_s.include?("gitea.trustie.net")
if user && user.try(:gitea_token).present?
repo_status = Gitea::Repository::GetService.new(user, r.identifier).call
if repo_status.present?
@@ -25,9 +25,12 @@ namespace :sync_forge_gitea do
}
begin
gitea_repository = Gitea::Repository::CreateService.new(user.gitea_token, repository_params).call
r.update_attribute(:url, gitea_repository["clone_url"])
project.update_attributes(gpid: repo_status["id"],identifier: r.identifier)
puts "__________after_create_gitea_repository_____#{gitea_repository}______"
if gitea_repository
r.update_attribute(:url, gitea_repository["clone_url"])
project.update_attributes(gpid: repo_status["id"],identifier: r.identifier)
puts "__________after_create_gitea_repository_____#{gitea_repository}______"
end

rescue => e
puts "_________create_gitea_git________file______error: #{e}"
end


Loading…
Cancel
Save