Skip to content

Instantly share code, notes, and snippets.

@tpitale
Forked from mig/rails_template.rb
Created December 14, 2009 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tpitale/256126 to your computer and use it in GitHub Desktop.
Save tpitale/256126 to your computer and use it in GitHub Desktop.
# tpitale_rails_template.rb
file 'config/routes.rb', <<-CODE
ActionController::Routing::Routes.draw do |map|
end
CODE
run "rm public/index.html"
run "rm public/images/rails.png"
run "rm public/favicon.ico"
run "rm public/robots.txt"
run "rm public/javascripts/controls.js"
run "rm public/javascripts/dragdrop.js"
run "rm public/javascripts/effects.js"
run "rm public/javascripts/prototype.js"
db_name = ask('What should I call the database? ')
if yes?("Do you want to use MongoDB? ")
initializer 'mongodb.rb', <<-CODE
MongoMapper.database = "#{db_name}_\#{Rails.env}"
CODE
file 'config/database.yml', <<-CODE
# Use mongodb
CODE
gem 'mongo_mapper'
end
if yes?("Do you want to use DataMapper? ")
adapter = ask("Which adapter will you be using? ")
file 'config/database.yml', <<-CODE
defaults: &defaults
adapter: #{adapter}
username:
password:
host: localhost
development:
<<: *defaults
database: #{db_name}_development
test:
<<: *defaults
database: #{db_name}_test
CODE
gem "extlib"
gem "data_objects"
gem "do_postgres"
gem "dm-core"
gem 'dm-aggregates'
gem 'dm-validations'
gem 'dm-migrations'
gem 'dm-timestamps'
gem 'dm-types'
gem "rails_datamapper"
end
if yes?("Do you want to use HAML?")
gem 'haml'
initializer 'haml_defaults.rb', <<-CODE
Haml::Template.options[:format] = :html5
CODE
end
gem "thoughtbot-shoulda", :lib => "shoulda", :source => "http://gems.github.com", :env => :test
gem "thoughtbot-factory_girl", :lib => "factory_girl", :source => "http://gems.github.com", :env => :test
gem 'jferris-mocha', :lib => 'mocha', :version => '>= 0.9.7', :env => :test
# Gem management
rake 'rails:freeze:gems'
if yes?("Do you want to clear out the AR's? ")
environment 'config.frameworks -= [:active_record, :active_resource]'
run "rm -rf vender/rails/activerecord"
run "rm -rf vender/rails/activeresource"
end
# source control
file '.gitignore', <<-FILES
.DS_Store
log
tmp
config/database.yml
coverage
FILES
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