#!/bin/sh

# Export Rails to .rails
svn co http://dev.rubyonrails.com/svn/rails/trunk .rails

# Run rails script for the name of the app
ruby .rails/railties/bin/rails --database=mysql $1

# Clean up .rails
rm -Rf .rails

# Go to new rails
cd $1

# Freeze edge rails
rake rails:freeze:edge

# Install plugins we use
# Rspec
ruby ./script/plugin install http://rspec.rubyforge.org/svn/trunk/rspec

# RSpec on rails
ruby ./script/plugin install http://rspec.rubyforge.org/svn/trunk/rspec_on_rails

# Generate spec for this
ruby ./script/generate rspec

# Exception Notification
ruby ./script/plugin install http://dev.rubyonrails.org/svn/rails/plugins/exception_notification/

# Create Database
RAILS_ENV=development rake db:create
RAILS_ENV=test rake db:create