Ruby On Rails, Design, Simplicity, Web 2.0, Ajax, Mac and Tons of Pizza.

Dec 19

Smart subversion script for Rails projects

Posted by Sandro Paganotti in Ruby on Rails - comments are closed digg this add to delicious

Using subversion is useful but sometimes very frustrating. You have to manually specify which files you want to ignore, and do this for each pc where the application is checkouted.

Luckily there is a very good-made page inside rails wiki called HowtoUseRailsWithSubversion that explain step by step how to create a trunk of you project,

But is not enough! Think, for each project you do you have to follow the same procedure! Doing this you’re violating one of the basic Ruby on Rails rules! DRY, aka Don’t Repeat Yourself!

We have the solution, here is a simple script you can add to you project and launch just after the first checkout. Do not repeat yourself anymore!


#!/bin/sh
svn remove log/*
svn commit -m"removing log files" 
svn propset svn:ignore "*.log" log/
svn update log/
svn commit -m 'Ignoring all files in /log/ ending in .log'
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'
svn remove tmp/*
svn propset svn:ignore "*" tmp/
svn update tmp/
svn commit -m "ignore tmp/ content from now" 
svn propset svn:ignore ".htaccess" config/
svn update config/
svn commit -m 'Ignoring .htaccess'
svn propset svn:ignore "dispatch.fcgi" config/
svn update config/
svn commit -m 'Ignoring dispatch.fcgi'

Comments

  • Giovanni

    Posted on December 19

    good job man ;)
  • Mark

    Posted on January 01

    This is a test
  • rag

    Posted on January 03

    great script! :)

Post a comment

Categories:

Tags:

Powered by Mephisto, Valid XHTML 1.1, Valid CSS - Supported by Wave Factory