Skip to content

Instantly share code, notes, and snippets.

@seenmyfate
Created April 23, 2014 07:55
Show Gist options
  • Save seenmyfate/11206162 to your computer and use it in GitHub Desktop.
Save seenmyfate/11206162 to your computer and use it in GitHub Desktop.
Capistrano v3 custom Submodule Strategy example
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
# ....other configuration
set :git_strategy, Capistrano::Git::SubmoduleStrategy
@pyrmont
Copy link

pyrmont commented Sep 5, 2014

Thanks! Went hunting through a bunch of different solutions but this was the one that worked for me.

@chrishough
Copy link

This worked perfectly for me, thank you for posting.

@ranchhand6
Copy link

Perfect. Thanks!

@wmakley
Copy link

wmakley commented Dec 17, 2018

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