With the recommendation from a friend I decided to use subversion to update the site. This has been great so far, and I wanted to go over my setup, hopefully it will be useful to someone else :)
Development
I have three checkouts of the repository:
- inscopeapps.com
- test.inscopeapps.com
- my local computer
This allows me to develop the site on my local computer or in the test sub-domain and refine and test the site before I update inscopeapps.com.
This was easy to setup, I just created a sub-domain and checked out the repository three times, twice on the server and once on my computer. This has proven to be a very flexible system because I can work in any checkout, commit the changes and then update the others.
I chose to make test a sub-domain so that I can easily switch between test and live urls.
svn:externals
InScopeApps uses two completely different back-ends: django a python based web framework and wordpress a php based blog. There is a directory in trunk for each:
- trunk/site - django
- trunk/blog - wordpress
But I have a core set of files that I need in both:
- trunk/core/images/
- trunk/core/style.css
Luckily subversion has a great mechanism for dealing with this, svn:externals. This svn property allows you to check out a directory, from a different part of the repository, into another directory.
So in my case core is pushed to:
- site/core
- blog/wp-content/themes/InScopeApps/core
Then the html in these directories points to the css: core/style.css.
Setting up svn:externals
It took me a little while to figure out this command and I had to read a couple of sites so Ill try my hand at explaining it.
- To use this command you need to tell subversion which editor to use, here are a couple of ways to do it, you only need one:
- In ~/.subversion/config enable editor-cmd, I suggest vi, even if you dont know it you only need to know insert(i), esc to exit editing, and save(ZZ).
- Set the environment variable SVN_EDITOR to an editor.
- Or use the flag –editor-cmd.
- If you see this error then the editor was not set correctly: svn: None of the environment variables SVN_EDITOR, VISUAL or EDITOR is set, and no ‘editor-cmd’ run-time configuration option was found
- Next use the command: svn propedit svn:externals *the/directory*. propedit does not work on your current directory like most svn commands, you need to tell it what directory to create the property on. If you want it on the current directory you can use a period: svn propedit svn:externals .
- Once you enter this line the editor you specified should open. Each line of the file will be an external reference, with two values on each line:
- core https://svn.repository.com/trunk/core
- gallery https://svn.repository.com/trunk/images
- The first value is the name of the directory that will be created, and the second value is the full path to the directory in the repository.
- Once the file is saved svn should tell you if the property was set successfully.
- Do a svn up on the directory that you just created the property on and you should see svn fetch the external files:
- Fetching external item into ‘blog/wp-content/themes/InScopeApps/core’
- To see what svn:externals is set to use: svn propedit svn:externals
Well I think thats it, hopefully you found some of this useful :)