如何发布 git 存储库 ruby 作为 zip 文件
Howto publish a git repository with ruby as zipfile
我正在使用 OpenProject 作为项目管理软件,我对 ruby 和 rails 不是很熟悉,但是使用 gitolite-plugin 效果很好嗯
我正在寻找一种解决方案,为 OpenProject 用户提供 link,他们可以直接 下载 gitolite 托管的 存储库作为压缩文件.
这可能吗?
我愿意将代码片段放在一起,所以即使是部分解决方案和提示也欢迎。
谢谢
oliverguenther/openproject-revisions_git
中的任何内容都不会做 :
git bundle
(一个文件中的完整回购历史)
git archive
(最新的工作树作为一个 zip 文件)
您需要扩展该插件以公开该功能,实施 ruby 函数以在正确的项目上调用 git-archive,bit like in this gist:
(摘录)
# Runs the `git archive` command to pull your repository out
# into a tar or tar.gz and writes it to a temporary directory
#
# Args:
# * path - path within the repository to archive, defaults to the root
#
# Returns the path to the tar file
def archive(path=nil)
@archive_path = path || ''
create_tmp_directory
@tar_path = "#{@tmp_directory_path}/archive.tar#{@gzip}"
Dir.chdir @path
puts "Archived repository" if run_shell_cmd "git archive --prefix=#{@archive_path}/ #{@branch}:#{@archive_path} -o #{@tar_path}" and @verbose
Dir.chdir @pwd
@tar_path
end
我正在使用 OpenProject 作为项目管理软件,我对 ruby 和 rails 不是很熟悉,但是使用 gitolite-plugin 效果很好嗯
我正在寻找一种解决方案,为 OpenProject 用户提供 link,他们可以直接 下载 gitolite 托管的 存储库作为压缩文件.
这可能吗?
我愿意将代码片段放在一起,所以即使是部分解决方案和提示也欢迎。 谢谢
oliverguenther/openproject-revisions_git
中的任何内容都不会做 :
git bundle
(一个文件中的完整回购历史)git archive
(最新的工作树作为一个 zip 文件)
您需要扩展该插件以公开该功能,实施 ruby 函数以在正确的项目上调用 git-archive,bit like in this gist:
(摘录)
# Runs the `git archive` command to pull your repository out
# into a tar or tar.gz and writes it to a temporary directory
#
# Args:
# * path - path within the repository to archive, defaults to the root
#
# Returns the path to the tar file
def archive(path=nil)
@archive_path = path || ''
create_tmp_directory
@tar_path = "#{@tmp_directory_path}/archive.tar#{@gzip}"
Dir.chdir @path
puts "Archived repository" if run_shell_cmd "git archive --prefix=#{@archive_path}/ #{@branch}:#{@archive_path} -o #{@tar_path}" and @verbose
Dir.chdir @pwd
@tar_path
end