I always forget about the ‘svn copy’ command, and Josh Susser has reminded me of its awesome usefulness. In this case, its usefulness as a way to start projects.
I took his advice a step further. Rolling on the idea of an ‘Image’ of a basic Rails project with its own repository, on top of setting the svn:ignore properties for log/ and tmp/ I also installed a couple things I use in almost every project:
I also generated an authenticated controller/model and added an initial user to my migration, so I’m all set to login. Before importing my ‘basicauth’ Rails image to subversion, I created my svn best practices directories (branches/ tags/ trunk/) and put the rails code into trunk.
After importing, I’m all set to start as many rails projects as I want. Why not use bash scripting to make it even easier.
#!/bin/bash echo 'Creating new rails app' cd ~/Sites/ echo 'Creating repository' svn copy svn+ssh://email@example.com/svn/rails/basicauth svn+ssh:/firstname.lastname@example.org/svn/rails/$1 echo 'Checking out code' svn co svn+ssh://email@example.com/svn/rails/$1/trunk $1 cd $1 mate .
If I save this, chmod +x it, and copy it to /usr/local/bin/ – Now all I have to do to start a new rails app is:
It will copy the repository, checkout the code, and even open it in TextMate.