A few days ago i already wrote about how to set up a svn for cake.
In this second part i will cover the aspect of managing several apps.
We have several apps, each with its own cake and vendor folder. If you need to update from 1.3.1 to 1.3.2 you would need to do that for each of your cake cores. Woudn’t it be nice if you changed one and all others would be updated automatically?
Lets say, our apps have the following svn rep. urls:
Both have the same structure:
Both vendor and cake folder we now want to substitute with our shared folders
Sharing Cake Core and Vendors
We now put our cake core in svn under the following url:
In both apps, we need to edit the properties for the /trunk folder with the following schema:
svn:externals svn_url local_folder
svn:externals http://123.456.789.000/cake13 cake
svn:externals http://123.456.789.000/vendors vendors
If you update the cake13 or vendors svn, both apps will get the updated version.
Especially if you have more than 2 apps, this will be very helpful.
Extending to other folders
/app/plugins is a very common folder where you should use svn:externals instead of just copying your plugins to all apps. One change in any plugin version will affect the other ones.
/app/libs can have subfolders, too. So /app/libs/lib/… could contain a "library of libs" for all apps.
The same goes for /app/views/helpers, /app/controller/components, /app/models/behaviors/ etc
Your test cases should be in "lib" folders then, too.
Both inside those shared lib folders which are attached with svn:externals (in this case parent folder "components").
This might make sense in some cases. Most of the time, though, it’s better to create some kind of "tools" plugin where you can combine all your "library" files (common libs, helpers, components, behaviors, …).
And the test cases are easier managed, as well.
You don’t necessarily need seperate svns for each external folder. They could all reside in one.
E.g with "common" svn:
svn:externals http://123.456.789.000/common/cake13 cake
svn:externals http://123.456.789.000/common/subfolder1/subfolder2/vendors vendors
Any svn subfolder is valid
NEW: Use github reps as external svns
Now you can include github reps in svn reps. Its as easy as including
in your folder properties.
This is especially useful, if you want to include one of the many cake plugins available at github without manually including it (changes would not be adopted).
Thats how i include my tools plugin in all my apps:
svn:externals https://svn.github.com/dereuromark/tools tools
(in my /app/plugins folder properties)
Note: Currently it does not seem to work the other way around. Although planned to be available very soon, it didn’t work for me committing to such a git-svn rep externally included.
But most of the time, a simple checkout is more than enough. If you need to change the rep, you can do that with git itself and then update the svn rep (it will get the changes then anyway).