How to create an empty Rails Edge application

I’ve been looking for this one a bit, so I thought I would share it here. As I wanted to start using the Rails 2.3+ application template feature, I thought I would create a script that is able to create an empty Rails edge application.

I found most of the required information here. Here it is packaged as a reusable ruby script:


#!/usr/local/bin/ruby

require 'fileutils'

def launch(cmd); puts cmd; throw "Error!" unless system(cmd); end

abort "Syntax: my_rails app_name" unless (app_name = ARGV.first)
abort "Folder #{app_name} already there! Remove it first." if File.exists?(app_name)

launch "mkdir -p #{app_name}/vendor" 

FileUtils.chdir app_name

launch "git clone git://github.com/rails/rails.git vendor/rails" 
launch "ruby vendor/rails/railties/bin/rails ." 

FileUtils.chdir '..'

Now I can enjoy the application template!

The comments system is brand new - don't be afraid to comment!