Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# Rails template for a basic project assuming the following:
#
# - MySQL for the DB
# - Git for version control
#
# Example: rails myapp -d mysql -m RailsTemplate.rb
#
# Author: Brian Smith (bsmith@swig505.com)
#
# Actions:
#
# - Rename README to README.md
# - Remove public/index.html and public/images/rails.png
#
# - Create config/database.yml with development and test db's (mysql)
# - Copy config/database.yml{,-example}
# - Add config/database.yml to gitignore
#
# - Init git repo
# - Initial commit
run "rm public/index.html"
run "rm public/images/rails.png"
run "rm public/favicon.ico"
run "mv README README.md"
File.open("config/database.yml-example","w") do |f|
f.write <<-EOF
development:
adapter: mysql
database: #{app_name}_dev
test:
adapter: mysql
database: #{app_name}_test
EOF
end
run "cp config/database.yml-example config/database.yml"
rake "db:create:all"
rake "db:migrate"
# Git Setup
#
File.open(".gitignore","w") do |f|
f.write <<-EOF
.DS_Store
.bundle
log/*.log
tmp/**/*
config/database.yml
doc/api
doc/app
EOF
end
git :init
git :add => "."
git :commit => "-a -m 'Initial commit'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.