views:

471

answers:

4

Im thinking of updating my practices, and looking for a little help and advice!

I do a lot of work on sites that run joomla, oscommerce, drupal etc and so I have created a lot of custom components/plugins and hacks etc. Currently each site has its own folder on my xampp setup. What I would like to do is have a default setup of (for example) a Joomla setup and when I make changes updates, I can do something which updates all the other folders that contain joomla, almost like an auto update?

Im also looking at using Aptana IDE more and SVN service such as unfuddle to share my work with others, but I have not used SVN before and not sure if its possible to do the above using SVN?

It would be great to be able to work on a main/core item and send the updates to both local updates and to actual servers, without having to maintain lots of different individual sites.

Suggestions?

+3  A: 

Yes, SVN would be a great tool for this purpose. Store your code (eg: a custom Joomla component) in source control. Wherever you want to use that component, just do a checkout or export of that particular folder into your live site. Here's one way you could structure your repository:

unfuddle.com/myRepo/trunk/com_myComponent
unfuddle.com/myRepo/trunk/com_anotherComponent

Log in to your live server via SSH and run this command:

> cd path/to/joomla/components
> svn co http://unfuddle.com/myRepo/trunk/com_myComponent

Any time you change your code, commit the changes and then log back into the server and run:

> cd path/to/joomla/components
> svn up com_myComponent

A real benefit of this is that should you do an update and break something, you can always roll it back to the last known "good" version.

As for automating this process, you might be out of luck if it's on different servers. For multiple deployments on the same server, you could quite easily write a shell script to run the above commands for each site/component. If you needed this to be fully automated, you could even set up a cron job to run this script every day at 2am or something - personally I'd stick with the manual approach, but it's still an option.

For working locally with your SVN repositories, I'd recommend looking at TortoiseSVN (if you're on Windows): it's the simplest and easiest way to work with SVN.

nickf
Some great advice, I fear that SVN is going to be an uphill struggle so your guide really helped. co - checkout up - update? Will this also put all the svn files into the folder or does this use a clean way of getting the files?
Paul M
yes, co = checkout, up = update. using checkout/update *will* create all the .svn folders with the SVN metadata, which is undesirable. Two ways around this: use "export" instead, or, use apache .htaccess files to disallow access to the .svn folder. Many people prefer the first option (not me though)
nickf
A: 

I don't have a good answer for your situation, but I don't think Subversion by itself is the answer.

This Question addresses some of the concerns about Subversion's mechanisms for sharing across 'projects'.

Subversion can certainly handle the source code management part of this puzzle. The automated distribution, well I'd use another tool.

Ken Gentle
Thanks for that I will certainly look into it
Paul M
A: 

Look into Capistrano. I've used it a couple of times and once you figure it out, it's pretty good. Aimed at rails but should work for anything where you need to get code from a repository and deploy it on different servers.

MattSmith
I will take a look it sounds interesting although we are running RHEL servers and I dont think they run ruby :(
Paul M
+2  A: 

For automating things, you could use SVN hooks for this. There is a post-commit hook, so every time you do a commit, your hook script could tell the other machines to do an SVN update to get the latest code.

For more info, see Version Control with Subversion - Implementing Repository Hooks.

RedFilter
Thats great I will take a look many thanks :)
Paul M