Ruby 通过 Gitlab 接口 如何打包下载版本库源码

return · 2016年12月20日 · 最后由 zml 回复于 2019年07月10日 · 2131 次阅读

gitlab archive 接口如下:

# Get an archive of the repository
# @param [Integer] project the ID fo a project.
# sha (optional) - The commit SHA to download defaults to the tip of the default branch
# @return [Gitlab::ObjectifiedHash]
def project_archive(project, sha)
  get("/projects/#{project}/repository/archive?sha=#{sha}")
end
alias_method :repo_project_archive, :project_archive

调用 archive 接口后,返回 [Gitlab::ObjectifiedHash] 类型,而我想直接 send file,有好的解决方法吗? 当然,如果使用:https://git.aaaaa.net/api/v3/projects/1/repository/archive?&private_token=XXXXXXXXXX 这样是可以直接下载,但是会暴漏 token 值

谢谢大家

怎么解决的

需要 登录 后方可回复, 如果你还没有账号请 注册新账号