Specify App root within git directory

42 views
Skip to first unread message

Pedro Rodriguez

unread,
May 22, 2014, 3:50:24 PM5/22/14
to capis...@googlegroups.com
For Capistrano 3, how do I tell it where my app is inside a git repo, if it is not at the root. Suppose I have something like
  • root of git repo
    • app-folder
      • this is the root of rails app, capfile, gemfile, etc
    • misc resources
    • other stuffs
How can I tell it can find my rails app in app-folder, instead of the root?

Lee Hambley

unread,
May 22, 2014, 3:57:49 PM5/22/14
to capistrano
For Capistrano 3, how do I tell it where my app is inside a git repo, if it is not at the root. Suppose I have something like

​You can't. You may have some success with looking at modifying the Git checkout code to perform a sparse checkout. (but it's not supported in most SCMs, and thus we can't widely support it)

slowjack2k

unread,
May 23, 2014, 6:23:51 PM5/23/14
to capis...@googlegroups.com
It's only a guess, but I think it can work. As far as I can see the git strategy can be replaced via

set
:git_strategy, MyMod

in you'r stage, deploy or cap file.

Now the interesting part is this in the strategy

def release
      git :archive, fetch(:branch), '| tar -x -f - -C', release_path
end

in  Capistrano::Git::DefaultStrategy


a new Module can change this behavior


module MyMod
include
Capistrano::Git::DefaultStrategy


  def release
      git :archive, fetch(:branch), '| tar -x -f -',' --strip', fetch(:levels_to_skip) ,' -C', release_path, fetch(:subfolder)
   end
end

I didn't test it, but tar should support extraction of only one special folder (fetch(:subfolder)).
--strip or --strip-components=, throws n levels of the directory structure away
Reply all
Reply to author
Forward
0 new messages