21

I'm wondering how add-on devs who's add-ons have themes use Git? For example, the way I do things now is to just make my add-ons repo the core folder; eg, securitee or ct_admin within the third_party directory will contain the .git folder.

This doesn't work with themes though since those are stored in a completely separate directory and path than the core add-on code.

I was thinking I may need to have a completely stand alone installation of ExpressionEngine for each add-on and just use a .gitignore file to only allow the add-on files. This sounds over complicated though so I'm hoping to avoid this.

Any other ideas?

29

I always lay my add-ons out to match the directory structure of a default ExpressionEngine install. For example, check out Freemember on github. I think this makes it most obvious for customers downloading the add-on (believe it or not we used to get questions about where to copy the files to).

In Store, my git directory structure looks like this:

  • /system/expressionengine/third_party/store
  • /themes/third_party/store
  • /Makefile etc (which I don't include in zip distribution)

I clone this git repo into my Dropbox folder, which sits in /Users/adrian/Dropbox/Dev/store

The final trick is simply to symlink your local EE install to your add-on directory. For example, (assuming your are using Max OS, Linux, or any other unix-based OS), to create links from my Dropbox folder to my EE install at ~/Sites/storedev:

cd ~/Sites/storedev/system/expressionengine/third_party
ln -s ~/Dropbox/Dev/store/system/expressionengine/third_party/store ./

cd ~/Sites/storedev/themes/third_party
ln -s ~/Dropbox/Dev/store/themes/third_party/store ./

Also, since you're using git for add-on development, I highly recommend checking out git flow for managing your different feature branches and releases.

  • This assumes Mac OS. Can you elaborate how symlinks work under Windows? – Natetronn Nov 16 '12 at 6:09
  • I know it's possible to create symlinks (at least since Win7 / Win2008), but I honestly have no idea how to do it. That's probably a question for Super User. – Adrian Macneil Nov 16 '12 at 6:26
  • 2
    Or alternatively, install VirtualBox and Vagrant, and do your development on a real unix OS ;) – Adrian Macneil Nov 16 '12 at 6:27
  • I use this little program for creating symlinks on Windows dirlinker.codeplex.com. – Joseph W Nov 16 '12 at 15:04
  • The concept of symbolic links remains the same, in Windows Vista+ there's a command mklink and there's probably plenty of software now. I don't remember what I've personally used but here are some links I found: Link Shell Extension, Sym Mover. If you haven't used symlinks before try it on some web host to get the feel for it (same commands Adrian shared, ln -s source target). – notacouch Nov 19 '12 at 15:28
4

I personally store the addons in a central "code" folder and then symlink the addons' third_party and themes folder to my sandbox folder. This way the git folder contains both system and themes addon folder.

4

I set this up by creating a "themes" directory inside my main repo. For instance with ProForm, my directory structure in development actually looks like this:

~/public_html/ee/third_party/proform/
__notes/
__static/
config/
docs/
language/
libraries/
models/
plugins/
templates/
tests/
themes/
views/
config.php
ext.proform.php
index.html
mcp.proform.php
mod.proform.php
README
tab.proform.php
upd.proform.php

I have multiple directories like this, one for each add-on that I write. Each of these is it's own git repository.

Notice that there is a directory here named "themes". This doesn't actually end up in this location within my produced ZIP files, but is just here to keep everything in one place within the repository.

I create a shared themes directory which contains soft links into each add-on:

$ cd ~/public_html/ee
$ mkdir themes
$ cd themes
$ ln -s ~/public_html/ee/third_party/proform/themes ./proform

This directory ends up with a single linked themes directory for each add-on.

I then have multiple EE installations, one for each point release that I test with. These go into directories such as

~/public_html/ee231
~/public_html/ee252

Within each of these, I go to it's system/expressionengine/ directory and create a soft link to the main third_party directory above:

$ cd ~/public_html/ee252/system/expressionengine
$ rm -rf third_party
$ ln -s ~/public_html/ee/third_party ./third_party

I then create a link to the themes directory which itself contains the soft links into each add-on:

$ cd ~/public_html/ee252/themes
$ rm -rf third_party
$ ln -s ~/public_html/ee/themes/third_party ./third_party

This way, I have all of my add-ons 1) in their own repos, 2) with a simple layout including the theme directory and 3) available for easy testing in all my supported EE versions.

Edit: I should also note that I use a build script which assembles the actual add-on directories into the expected structure prior to zipping them up - for example, for ProForm this is:

  1. Removes all directories that start with __
  2. Moves the root into {zip_base}/system/expressionengine/third_party/proform
  3. Moves the themes/ directory into {zip_base}/themes/third_party/proform

Finally, I also manage all of this using the excellent git-flow strategy. My build script will produce a ZIP file using this logic from any point release tagged by git-flow, and will automatically include reusable libraries or other bits that I need to assemble (such as building static documentation HTML from sources, including ProLib, etc.).

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.