Archive for December, 2007

Create a subversion repository for rails

First you need a directory to house your repository. Since I work on multiple projects at home and in the office I need a master directory first. And just to make it simple I use /repos. This could be a link or a real directory.
(To clean-out a old svn directory use the following find . -name .svn -exec ‘rm -rf {}\;‘)
Step 1:
# create /repos
Step 2 (Create a repository):
# svnadmin create /repos/rails_project
Step 3 (Create rails specific directories):
# export REPOS=file:///repos/rails_project
# svn mkdir –message=”Initial project layout” $REPOS/trunk $REPOS/tags $REPOS/branches
Step 4 (Initial Import of project):
# cd /rails_project
# svn import . file:///repos/rails_project/trunk -m “Initial Import…” */ This command import everything from the current directory to the svn server running locally using the file:/// structure */
Step 5 (check-out):
# svn co file:///repos/rails_project/trunk rails_project
# svn co svn://subversion_server/rails_project/trunk rails_project
Both of the above command will checkout the trunk of rails_project into a directory called rails_project.
Step 6 (Rails clean-up):
Go into the newly checked-out rails project
*/ Remove and Ignore the log files */  
# svn remove log/* 
# svn commit -m ‘removing all log files from subversion’ 
# svn propset svn:ignore “*.log” log/ 
# svn update log/ 
# svn commit -m ‘Ignoring all files in /log/ ending in .log */ Remove and Ignore tmp directory */   
# svn remove tmp/* 
# svn commit -m ‘removing all tmp artifacts from subversion’ 
# svn propset svn:ignore “*” tmp/ 
# svn update tmp/ 
# svn commit -m “ignore tmp/ content from now on” */ Move the database config file to an example file and ignore */   
# svn move config/database.yml config/database.example 
# svn commit -m “Moving database.yml to database.example to provide a template for anyone who checks out the code” 
# svn propset svn:ignore “database.yml” config/ 
# svn update config/ 
# svn commit -m “Ignoring database.yml”