Created
October 23, 2010 20:36
-
-
Save evanwalsh/642669 to your computer and use it in GitHub Desktop.
My personal template for my Rails projects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Evan Walsh Rails template - version 3 | |
@after_blocks = [] | |
def after_bundler(&block); @after_blocks << block; end | |
def say_wizard(text); say "\033[36m" + "wizard".rjust(10) + "\033[0m" + " #{text}" end | |
# Remove some junk I don't need | |
inside('public') do | |
FileUtils.rm_rf %w(index.html 404.html 422.html 500.html favicon.ico) | |
end | |
inside('public/images') do | |
FileUtils.rm_rf %w(rails.png) | |
end | |
inside('public/javascripts') do | |
FileUtils.rm_rf %w(controls.js dragdrop.js effects.js prototype.js rails.js) | |
end | |
# Add jQuery | |
inside "public/javascripts" do | |
get "http://github.com/rails/jquery-ujs/raw/master/src/rails.js", "rails.js" | |
get "http://code.jquery.com/jquery-latest.min.js", "jquery/jquery.min.js" | |
end | |
# Setup some files | |
initializer 'jquery_setup.rb', <<-CODE | |
ActionView::Helpers::AssetTagHelper.register_javascript_expansion :jquery => ['jquery', 'rails'] | |
CODE | |
file 'Gemfile', <<-CODE | |
source 'http://rubygems.org' | |
# Next-level stuff | |
gem 'rails', '~> 3.0.3' | |
gem 'sinatra', '~> 1.0' | |
gem 'delayed_job', '~> 2.1.2' | |
gem 'delayed_job_mongoid', '~> 1.0.1' | |
# Database | |
gem 'mongo', '~> 1.1' | |
gem 'bson', '~> 1.1' | |
gem 'bson_ext', '~> 1.1' | |
gem 'mongoid', '>= 2.0.0.beta.20' | |
# Authentication and authorization | |
gem 'cancan', '~> 1.4.0' | |
gem 'roles_mongoid', '~> 0.4.0' | |
gem 'devise', '~> 1.1' | |
# Markup | |
gem 'rdiscount', '~> 1.6.5' | |
# File uploading | |
gem 'carrierwave', '~> 0.5.0' | |
gem 'fog', '~> 0.3.13' | |
gem 'rmagick', '~> 2.13.1' | |
# Misc. | |
gem 'simple_form', '~> 1.2.2' | |
gem 'will_paginate', '~> 3.0.pre2' | |
group :development do | |
gem 'compass', '~> 0.10.6.pre.1' | |
end | |
group :test, :development do | |
gem 'rspec-rails', '~> 2.0.1' | |
gem 'steak', '~> 1.0.0' | |
gem 'capybara', '~> 0.4.0' | |
gem 'miniskirt', '~> 0.9.1' | |
gem 'database_cleaner', '~> 0.6.0' | |
gem 'mongoid-rspec', '~> 1.3.2' | |
end | |
CODE | |
file 'app/helpers/application_helper.rb', <<-CODE | |
module ApplicationHelper | |
include ActionView::Helpers | |
def title(page_title) | |
content_for(:title) { page_title } | |
end | |
def flash_messages | |
if flash | |
@output = String.new | |
flash.each do |type,message| | |
@output << content_tag(:div, message, :class => "flash \#{type}") | |
end | |
raw @output | |
end | |
end | |
end | |
CODE | |
file '.gitignore', <<-FILE | |
.DS_Store | |
log/*.log | |
tmp/**/* | |
config/database.yml | |
db/*.sqlite3 | |
public/uploads/* | |
gems/* | |
!gems/cache | |
!gems/bundler | |
FILE | |
git :init | |
git :submodule => "init" | |
git :add => '.' | |
git :commit => "-a -m 'GONNA KNOCK YO LIGHTS OUT'" | |
after_bundler do | |
generate 'mongoid:config' | |
generate 'rspec:install' | |
generate 'steak:install' | |
end | |
# say_wizard "Running Bundler install. This will take a while." | |
# run 'bundle install' | |
# say_wizard "Running after Bundler callbacks." | |
# @after_blocks.each{|b| b.call} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment