Page 1 of 1

SVN set up for Joomla Components

Posted: Wed Aug 19, 2009 9:52 am
by mokelly
I recently began using SVN for component development and have a basic understanding. I have 3 branches for each component, admin,site,and install. I keep my .xml file in install to track changes to it.

1. How do I assign version numbers to my component. Lets say my admin is revision 5 and my site is revision 20 and my install is revision 7. How do I find these revision numbers and what is a good scheme for making the version number of the entire component? 5.20.7?

2. How to deal with the .XML file in the admin section. When a component is installed, the .xml file is stored in the admin section of the component. When I check out the admin side of a component for updating and testing I need the .xml file in the admin section. When I export the admin side of the component to a directory to create the installable archive, the file is in the admin side which causes an installation error. Is there a way to set up the svn repository or xml file to avoid this? Should I write a script to automate the export which deletes the offending .xml?

3. I currently have working copies of any given component in several places. I read part of a thread that suggested that with Linux I could use soft links from the directory that I actually use for checkout to the various Apache directories that are used for testing. What is the command line for setting up soft links and are there any Apache settings that need to be changed?

Thank you!

Re: SVN set up for Joomla Components

Posted: Sun Aug 23, 2009 9:59 am
by mokelly
I have revised my thinking somewhat and devised some linux shell scripts to automate my set up. So far I think it is very clever.

1. I keep each Joomla module in two repositories, site and admin. I am using the admin version and site version numbers in assigning version numbers to my release. admin = 31 site = 27 then my version is 1.31.27. Version one changes to two when the sql changes.

2.-3. I have a number of scripts to automate this. To make it work well, I named the repository parent directory the same as the component - com_yourcomponent. So I have /srv/svn/com_yourcomponent.

I keep all the files that end up in the admin part of a component in an admin branch, of the directory named after the component, /svn/com_yourcomponent/branches/admin, with admin being the actual repository of those scripts. Similarly I keep the site repository in a directory called /svn/com_yourcomponent/branches/site. I am not sure why I threw in the directory for branches. It seems there should be a better set up for handling branches of the code.

To create the intallable zip file I use the following script named z.sh where the first parameter is the component name:

rm -R /home/mydir/joomla/Extensions/$1/*
svn export file:///srv/svn/$1/branches/admin /home/mydir/joomla/Extensions/$1/admin
svn export file:///srv/svn/$1/branches/site /home/mydir/joomla/Extensions/$1/site
cp /home/mokelly1/joomla/Extensions/gpl.txt /home/mydir/joomla/Extensions/$1
cp /home/mokelly1/joomla/Extensions/$1/admin/index.html /home/mydir/joomla/Extensions/$1
mv /home/mokelly1/joomla/Extensions/$1/admin/*.xml /home/mydir/joomla/Extensions/$1
mv /home/mokelly1/joomla/Extensions/$1/admin/install.*.php /home/mydir/joomla/Extensions/$1
cd /home/mydir/joomla/Extensions
zip -r $1.zip $1/*

You will notice on line 4, I copy the GPL license and on line 5 copy a new index.html to the file. I seldom remember to include the GPL and the index.html allows the installation to work.

To make a working copy that I can update and test in my sandbox, I install the component and then run this script named w.sh where the first parameter is the component name:

rm -R /srv/www/htdocs/mydomain.com/administrator/components/$1
rm -R /srv/www/htdocs/mydomain.com/components/$1
rm -R /home/mydir/public_html/$1/admin
rm -R /home/mydir/public_html/$1/site
svn checkout file:///srv/svn/$1/branches/admin /home/mydir/public_html/$1/admin
svn checkout file:///srv/svn/$1/branches/site /home/mydir/public_html/$1/site
ln -s /home/mydir/public_html/$1/admin /srv/www/htdocs/mydomain.com/administrator/components/$1
ln -s /home/mydir/public_html/$1/site /srv/www/htdocs/mydomain.com/components/$1

This removes the component scripts that were just installed into Joomla and replaces them with a link to a fresh working copy in my home directory.

The component still works in the web server but I am actually revising and testing the working copy in my home directory.

When the revisions are complete, I commit using the graphic interface eSvn. Then in order to correctly test the new version, I run the following script named r.sh where the first parameter is the component name:

rm -R /srv/www/htdocs/mydomain.com/administrator/components/$1
rm -R /srv/www/htdocs/mydomain.com/components/$1
svn export file:///srv/svn/$1/branches/admin /srv/www/htdocs/mydomain.com/administrator/components/$1
svn export file:///srv/svn/$1/branches/site /srv/www/htdocs/mydomain.com/components/$1
chown -R wwwrun:www /srv/www/htdocs/mydomain.com/administrator/components/$1/*
chown -R wwwrun:www /srv/www/htdocs/mydomain.com/components/$1

This removes the links to the home directory in the sandbox component and exports the latest version to the component directories for site and admin. Now I am able to correctly un-install the Joomla component, then install the new revised component from the zip file created with the first script. This way the install is tested as well as the new revisions.

I am not sure if I am handling permissions correctly for the best security.

To really make this process seem automated, I created icons on the desktop to call these scripts for each component. So I am doing more clicking and less wondering what to do next.

Now if I could just automate the version portion of the zip file name that would be nice!

Hope this helps save you time! 8)

Re: SVN set up for Joomla Components

Posted: Wed Aug 29, 2012 11:32 am
by muthu4all
Does this setup of SVN works better for component development? Can someone recommend a best way to setup SVN setup for component development?