Skip to content

Instantly share code, notes, and snippets.

View twmills's full-sized avatar

Theo Mills twmills

View GitHub Profile
file 'Gemfile', %{
source 'http://rubygems.org'
gem 'rails', '#{Rails::VERSION::STRING}'
group :development do
gem 'ruby-debug'
end
}.strip
gem "ruby-debug", :group => :development
gem "machinist", :group => :test
gem "rspec", :group => :test
gem 'haml', '3.0.14'
gem "rails3-generators", :group => :development
gsub_file 'config/application.rb', /# Configure the default encoding used in templates for Ruby 1.9./ do
<<-RUBY
config.generators do |g|
g.template_engine :haml
end
# Configure the default encoding used in templates for Ruby 1.9.
#----------------------------------------------------------------------------
# Remove unnecessary Rails files
#----------------------------------------------------------------------------
run 'rm README'
run 'rm public/index.html'
run 'rm public/favicon.ico'
run 'rm public/images/rails.png'
run 'touch README'
# Rotate log files (50 files max at 1MB each)
log_path = '#{Rails.root}/log/#{Rails.env}.log'
# Alter the application file with new configs
gsub_file 'config/application.rb', /# Custom directories with classes and modules you want to be autoloadable./ , %{
config.logger = Logger.new(\"#{log_path}\", 50, 1048576)
config.autoload_paths += %W(\#{config.root}/lib)
}
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 "cd tmp; git clone git://gist.github.com/556570.git application.html.haml"
run "cp -R tmp/application.html.haml app/views/layouts"
run "cd tmp; git clone http://github.com/paulirish/html5-boilerplate.git"
run "cp -R tmp/html5-boilerplate/*.* public/"
run "cp -R tmp/html5-boilerplate/js/* public/javascripts/"
run "cp -R tmp/html5-boilerplate/css/* public/stylesheets/"
puts "setting up Gemfile for Devise..."
append_file 'Gemfile', "\n# Bundle gem needed for Devise\n"
gem 'devise', '1.1.1'
puts "installing Devise gem (takes a few minutes!)..."
run 'bundle install'
run "rails g devise:install"
puts "modifying environment configuration files for Devise..."
puts "setting up Gemfile for Mongoid..."
gsub_file 'Gemfile', /gem \'sqlite3-ruby/, '# gem \'sqlite3-ruby'
append_file 'Gemfile', "\n# Bundle gems needed for Mongoid\n"
gem 'mongoid', '2.0.0.beta.16'
gem 'bson_ext', '1.0.4'
puts "installing Mongoid gems (takes a few minutes!)..."
run 'bundle install'
puts "creating 'config/mongoid.yml' Mongoid configuration file..."
#----------------------------------------------------------------------------
# Git Setup
#----------------------------------------------------------------------------
append_file '.gitignore', %{
/.bundle
.DS_Store
log/*.log
tmp/**/*
config/database.yml
db/*.sqlite3
#----------------------------------------------------------------------------
# Capistrano
#----------------------------------------------------------------------------
capify!
file 'Capfile', <<-FILE
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy'
FILE