用Capistrano 3部署git子模块 [英] Deploying a git submodule with Capistrano 3

查看:179
本文介绍了用Capistrano 3部署git子模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目回购包括Wordpress作为git子模块。当通过Capistrano 3部署时,子模块目录是无效的。

 项目
--wordpress
- 图像

我正在使用git和:deploy_via,:remote_cache



如何告诉Capistrano还要部署子模块?

解决方案>

我发现一个好的脚本来自corny,它覆盖了Capistrano中的git任务。



将这个脚本放在 lib / capistrano / tasks / git.cap 并使用 cap< em> stage< / em>正常运行



https://gist.github.com/corny/7459729

 #将此文件另存为lib / capistrano /tasks/git.cap 

命名空间:git do
desc'将repo复制到版本
任务create_release::'git:update'do
on roles( :所有)使用fetch(:git_environmental_variables)执行
在repo_path中执行

执行:git,:clone,'-b',fetch(:branch),'--recursive' '。',release_path
end
end
end
end
end


My project repo includes Wordpress as a git submodule. When deploying via Capistrano 3, the submodule directory is barren.

project
--wordpress
--images

I am using git and :deploy_via, :remote_cache

How can I tell Capistrano to also deploy the submodule?

解决方案

I found a great script from corny that overrides the git task in Capistrano.

Place this script in lib/capistrano/tasks/git.cap and use cap <em>stage</em> deploy as normal.

https://gist.github.com/corny/7459729

# Save this file as lib/capistrano/tasks/git.cap

namespace :git do
  desc 'Copy repo to releases'
  task create_release: :'git:update' do
    on roles(:all) do
      with fetch(:git_environmental_variables) do
        within repo_path do
          execute :git, :clone, '-b', fetch(:branch), '--recursive', '.', release_path
        end
      end
    end
  end
end

这篇关于用Capistrano 3部署git子模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆