12

I'm having some problems working with zf and git in a pretty large project. The zf application has about 20 modules and for the moment everything is stored in a single git repository. So when you checkout the application, you checkout the entire set of modules, css sheets, js files, etc.

What I would like to do, is something like in wordpress or drupal: you have your core application and for each module you have a separate git repository that you checkout in the modules directory. After checkout, you work on it and then you commit it. But with zend you can't do this because the media files (css, js, images) are stored in a way different directory in /public (each module may have it's own css, js files in /public/_MODULE_NAME_/css for example). I am working in /application/modules/.

So the question is how do you work with zend framework modular applications and git?

Alex Dicianu
  • 369
  • 1
  • 3
  • 9
  • 3
    You could always put the static resources (CSS, JS, etc) inside your module directory and either copy them to `public` as a build task or create symlinks in `public` – Phil Jul 06 '12 at 08:30
  • sounds to me like a similar problem that I once had: http://stackoverflow.com/questions/6680768/how-do-i-organize-my-git-repo – eckes Jul 06 '12 at 08:35
  • In ZF2 the modules are fully independent, they can be attached as a submodule (completely separate repo), but in ZF1 with its given structure this is not possible. – bedeabza Jul 24 '12 at 11:09
  • 2
    I do not know about the Zend part, but I think the submodule funtion of git might be useful in this case. http://git-scm.com/book/en/Git-Tools-Submodules – Richard Jul 24 '12 at 13:04
  • @AlexDicianu: opened bounty hoping that solving your problem could also solve my problem... – eckes Jul 25 '12 at 17:00
  • This answer might work for you: http://stackoverflow.com/a/1618068/305865 – Zak Jul 25 '12 at 17:39

1 Answers1

2

I usually manage to cope with a setup of soft links, having one super project in the webfolder and symlinking the Modules from a different folder in:

* SuperProject/
  + application/
    + ModuleA --> ../../Modules/ModuleA/application
    + ModuleB --> ../../Modules/ModuleB/application
    + config/
    + views/
    + layouts/
  + public/
    + ModuleA --> ../../Modules/ModuleA/public
    + ModuleB --> ../../Modules/ModuleB/public
    + css/
    + js/
  + library/
+ Modules/
  * ModuleA/
    + application/
      + config/
      + views/
      + models/
    + public/
      + css/
      + js/
  * ModuleB/
    + application/
      + config/
      + views/
      + models/
    + public/
      + css/
      + js/

The starred directories are repositories, the SuperProject/public is the entry point for the http server (with symlinks follow enabled of course). You obviously do not add any Module-Files in your SuperProject repository, but only changes in the global directories (e.g. application/config/) - at best, you ignore the Modules through the .git_ignore-file. As this method relies on symlinks, it will only work on unixoid systems. While not being perfect, it's the least hassle.

Lars
  • 5,757
  • 4
  • 25
  • 55
  • regarding symlinks: could this work on Win32 with junctions (http://technet.microsoft.com/en-us/sysinternals/bb896768.aspx, http://en.wikipedia.org/wiki/Symbolic_link#NTFS_Junction_points)? – eckes Jul 26 '12 at 20:01
  • @eckes this might work, haven't tried it yet. But from a quick research, it seems to implement the same feature as a unixoid symlink. Do you have a windows system to test it on? – Lars Jul 26 '12 at 22:14
  • only XP. And the really interesting thing (NTFS symbolic links that support also files, not only folders, http://en.wikipedia.org/wiki/NTFS_symbolic_link) doesn't work there but needs at least Vista. – eckes Jul 27 '12 at 05:09