|
|
|
@@ -1,7 +1,7 @@ |
|
|
|
class Api::V1::Projects::Branches::ListService < ApplicationService |
|
|
|
|
|
|
|
attr_accessor :project, :token, :owner, :repo, :name, :page, :limit |
|
|
|
attr_accessor :gitea_data |
|
|
|
attr_accessor :gitea_data, :gitea_repo_data |
|
|
|
|
|
|
|
def initialize(project, params, token=nil) |
|
|
|
@project = project |
|
|
|
@@ -16,6 +16,8 @@ class Api::V1::Projects::Branches::ListService < ApplicationService |
|
|
|
def call |
|
|
|
load_gitea_data |
|
|
|
|
|
|
|
gitea_data["default_branch"] = gitea_repo_data["default_branch"] |
|
|
|
|
|
|
|
gitea_data |
|
|
|
end |
|
|
|
|
|
|
|
@@ -32,9 +34,12 @@ class Api::V1::Projects::Branches::ListService < ApplicationService |
|
|
|
end |
|
|
|
|
|
|
|
def load_gitea_data |
|
|
|
puts request_params |
|
|
|
@gitea_data = $gitea_client.get_repos_branches_by_owner_repo(owner, repo, {query: request_params}) rescue nil |
|
|
|
puts @gitea_data |
|
|
|
@gitea_data = $gitea_hat_client.get_repos_branches_by_owner_repo(owner, repo, {query: request_params}) rescue nil |
|
|
|
raise Error, '获取分支列表失败!' unless @gitea_data.is_a?(Hash) |
|
|
|
end |
|
|
|
|
|
|
|
def load_default_branch |
|
|
|
@gitea_repo_data = $gitea_client.get_repos_by_owner_repo('yystopf', 'pig') rescue nil |
|
|
|
raise Error, '获取仓库信息失败!' unless @gitea_data.is_a?(Hash) |
|
|
|
end |
|
|
|
end |