capistrano / capistrano

A deployment automation tool built on Ruby, Rake, and SSH.

Home Page:http://www.capistranorb.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

copy_exclude not considered on Cap 3 deployments

ain opened this issue · comments

set :copy_exclude, %w{.git .DS_Store web concept config lib}

is not considered by Capistrano 3, is there a replacement setting that achieves the same or is it a subject to custom implementation in v3?

Specs:

  • Git
  • Capistrano Version: 3.0.0.pre3 (Rake Version: 10.0.4)
  • ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-darwin11.4.2]

Ain, it's just not implemented at all, yet (until someone needs it!) - I
assume the behaviour that you are looking for should skip getting files
matching that pattern out of the git repository?

Totally. I've just implemented a custom cleanup task kicking them after finishing.

I wonder if there's an way we could do this with git archive to skip those files.... I'll have a quick think, do you think it'd be a problem to do something like:

cd the-git-cache
git pull # whatever we do here
cd -
git archive master | tar -x -C ../releases/________________

With git archive the export-ignore attribute is honored, read more: https://help.github.com/articles/ignoring-files

I know the previous approach with Cap has been to rely on rsync for this, which has a consistent copy-exclude strategy, but it seems wasteful to

a) have the cache be a working-copy repository
b) use rsync when Git has this built in
c) if using a bare cache (which we do now, and with good reason) to clone that somewhere else, only to use rsync to copy it to the release to use the ignore stuff.

what do you think? I find Git's export-ignore to be a decent solution to this problem, and it would just mean using git archive versus git clone to get from the cache, to the release directory.

Sorry, that was a crap link to export-ignore http://feeding.cloud.geek.nz/posts/excluding-files-from-git-archive/ is better.

There's an error in the above commit Re .gitattributes example as it should be:

/features export-ignore
/spec     export-ignore

Otherwise the solution works brilliantly and speeds up the deployments considerably.

In order to still be able getting a complete export of the repository (including specs etc.) I decided myself to add those folders to linked_dirs instead.

Is export-ignore documented somewhere? Google search shows no documentation for this.

search for "git export-ignore", e.g. http://git-scm.com/docs/gitattributes