I have a fairly complex WordPress + bbPress installation and I would like to handle version control for all the custom code in subversion. What follows is the approach I have settled on and I would appreciate input/critique. Is there a better way to do this?
Although my situation involves WordPress I am describing things in general terms and the problem applies to any number of other frameworks where you end up with large amounts of custom code spread around a larger system.
The hierarchy of the deployed site (below html root) looks as follows (somewhat simplified for illustration):
CUSTOM-directory
wp-admin
wp-content
- <other directories>
- themes
- <CUSTOM theme directories>
- <other theme directories>
- plugins
- <CUSTOM plugin files & directories>
- <other plugin files & directories>
wp-includes
<other files>
I want to put all the directories that contain "CUSTOM" under version control. So I set up a hierarchy as follows and imported it into a new repo.
website
- trunk
- CUSTOM-directory
- themes
- plugins
- branches
- tags
Since "themes" and "plugins" in the deployed hierarchy contain files and folders in addition to my custom code, I added this other stuff to the ignore property of these two directories.
I am making changes in three places: a dev machine (where most of the action takes place), a staging/testing server that is almost identical to my production environment, and the production server (only minor changes). The initial setup in these three places is a little time consuming because I have to check out each directory below trunk into its correct place in the hierarchy. But that is a one-time hassle.
I wrote a few simple shell scripts to automate svn tasks once this is all set up. For example: svn-commit.sh
(which would run from the root of the Wordpress installation)
#!/bin/sh
svn commit CUSTOM-directory "$@"
svn commit wp-content/plugins "$@"
svn commit wp-content/themes "$@"
I have also checked out a separate working copy on my dev machine that is purely my custom code so that I can do drag and drop repo maintenance using Versions.
So, what do you think? Is there an easier way? I also considered:
Putting the whole mess under version control. I thought would create too much repo admin overhead as I dealt with other people refactoring their code.
Putting the whole hierarchy under version control and setting ignore for everything but my code. Again, this would involve too much ongoing admin overhead maintaining the ignore properties.
Finally, are there any security issues around having .svn folders hanging around in my production site?