Created
April 23, 2014 07:55
-
-
Save seenmyfate/11206162 to your computer and use it in GitHub Desktop.
Capistrano v3 custom Submodule Strategy example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'capistrano/setup' | |
require 'capistrano/deploy' | |
require 'capistrano/scm' | |
require 'capistrano/git' | |
class Capistrano::Git < Capistrano::SCM | |
module SubmoduleStrategy | |
include DefaultStrategy | |
def release | |
context.execute :rm, '-rf', release_path | |
git :clone, '--branch', fetch(:branch), | |
'--recursive', | |
'--no-hardlinks', | |
repo_path, release_path | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ....other configuration | |
set :git_strategy, Capistrano::Git::SubmoduleStrategy |
Thanks! Went hunting through a bunch of different solutions but this was the one that worked for me.
This worked perfectly for me, thank you for posting.
Perfect. Thanks!
Trying to find some way to do this, but this doesn't work in Capistrano 3.11 since the DefaultStrategy
constant is not found.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From the v2 code:
https://github.com/capistrano/capistrano/blob/legacy-v2/lib/capistrano/recipes/deploy/scm/git.rb#L132
Should I need to do a "git submodule update --init --recursive" to have a submodule from a submodule cloned, or this code is enough?
Also, where should I override to disable the removing o .git folder?