Skip to content

Instantly share code, notes, and snippets.

@mig
Forked from bscofield/gist:181842
Created September 20, 2009 13:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save mig/189798 to your computer and use it in GitHub Desktop.
Save mig/189798 to your computer and use it in GitHub Desktop.
# mig_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"
if yes?("Do you want to use jQuery?")
run "rm public/javascripts/controls.js"
run "rm public/javascripts/dragdrop.js"
run "rm public/javascripts/effects.js"
run "rm public/javascripts/prototype.js"
run "curl -L http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js > public/javascripts/jquery.js"
end
if yes?("Do you want to use MongoDB?")
db_name = ask('What should I call the database? ')
initializer 'mongodb.rb', <<-CODE
db_config = YAML::load(File.read(RAILS_ROOT + "/config/database.yml"))
if db_config[Rails.env] && db_config[Rails.env]['adapter'] == 'mongodb'
mongo = db_config[Rails.env]
MongoMapper.connection = Mongo::Connection.new(mongo['hostname'])
MongoMapper.database = mongo['database']
end
CODE
file 'config/database.yml', <<-CODE
development:
adapter: mongodb
host: localhost
database: #{db_name}-development
test: &TEST
adapter: mongodb
host: localhost
database: #{db_name}-test
CODE
environment 'config.frameworks -= [:active_record]'
gem 'jnunemaker-mongomapper', :lib => 'mongomapper', :source => 'http://gems.github.com'
end
if yes?("Do you want to use RSpec for testing?")
plugin "rspec", :git => "git://github.com/dchelimsky/rspec.git"
plugin "rspec-rails", :git => "git://github.com/dchelimsky/rspec-rails.git"
generate :rspec
else
gem 'mhennemeyer-matchy', :lib => 'matchy', :source => 'http://gems.github.com', :env => :test
gem 'mocha', :env => :test
gem 'jeremymcanally-context', :lib => 'context', :source => 'http://gems.github.com', :env => :test
end
if yes?("Do you want to use HAML?")
gem 'haml'
initializer 'haml_defaults.rb', <<-CODE
Haml::Template.options[:format] = :html5
CODE
end
# Gem management
run 'sudo rake gems:install'
rake 'gems:unpack'
rake 'rails:freeze:gems'
# source control
file '.gitignore', <<-FILES
.DS_Store
**/.DS_Store
log/*
tmp/*
tmp/**/*
config/database.yml
coverage/*
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