I just created my first balloon! Balloons are web pages that double as Ruby programs.
This magical balloon will automatically configure your subversion repository for a new Rails project. It goes like this: make a new Rails project in a working copy directory, inflate the balloon, and presto! Your repository is configured.
http://balloon.hobix.com/svn_configure
Here’s what the balloon does:
- Adds all files
- Ignores files in tmp/ and log/
- Creates a sample database.yml and ignores the original
- Sets permissions for log/ and public/dispatch.*
- Tells subversion which files should be executable
This won’t automatically check in changes; you must check them in yourself.
Here’s the Ruby that makes it all possible.
require 'fileutils'
def ignore(path, pattern='*')
`svn rm #{path}/#{pattern} --force`
`svn propset svn:ignore '#{pattern}' #{path}`
end
# Backup the database.yml file
FileUtils.cp 'config/database.yml', 'config/database.yml.tpl'
# Add all the files
`svn add . --force`
# Ignore stuff
ignore 'config', 'database.yml'
ignore 'tmp'
ignore 'log'
# Copy database.yml back
FileUtils.cp 'config/database.yml.tpl', 'config/database.yml'
# Set the correct permissions for logs
FileUtils.chmod 0775, 'log'
# Set permissions for dispatchers
%w{rb cgi fcgi}.each { |ext| FileUtils.chmod 0755, "public/dispatch.#{ext}" }
# Tell subversion which files are executables
`svn propset svn:executable ON public/dispatch.* script/process/*`


Useful, Thanks!
Sweet balloon. I’ll try this out on my next project.