ruby Capistrano部署策略支持git子模块(需要Capistrano v3.1.0或更高版本)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ruby Capistrano部署策略支持git子模块(需要Capistrano v3.1.0或更高版本)相关的知识,希望对你有一定的参考价值。


# this include won't work for some reason:
# include Capistrano::Git::DefaultStrategy

module SubmoduleStrategy

  # check for a .git directory
  def test
    test! " [ -d #{repo_path}/.git ] "
  end

  # same as in Capistrano::Git::DefaultStrategy
  def check
    test! :git, :'ls-remote', repo_url
  end

  def clone
    git :clone, '-b', fetch(:branch), '--recursive', repo_url, repo_path
  end

  # same as in Capistrano::Git::DefaultStrategy
  def update
    git :remote, :update
  end

  # put the working tree in a release-branch,
  # make sure the submodules are up-to-date
  # and copy everything to the release path
  def release
    release_branch = fetch(:release_branch, File.basename(release_path))
    git :checkout, '-b', release_branch, fetch(:remote_branch, "origin/#{fetch(:branch)}")
    git :submodule, :update, '--init'
    context.execute "rsync -ar --exclude=.git\* #{repo_path}/ #{release_path}"
  end

end

以上是关于ruby Capistrano部署策略支持git子模块(需要Capistrano v3.1.0或更高版本)的主要内容,如果未能解决你的问题,请参考以下文章

capistrano 部署 - 基本命令失败

部署后缺少宝石(Ruby,Ruby on Rails,Capistrano)

ruby 周五为Capistrano部署脚本

ruby Capistrano的部署,Recipe.rb

ruby Capistrano 2为乘客提供Nginx的部署脚本

ruby 简单的Capistrano部署为Docker管理的应用程序