Skip to content

Instantly share code, notes, and snippets.

@ayosec
Created March 7, 2011 17:10
Show Gist options
  • Save ayosec/858810 to your computer and use it in GitHub Desktop.
Save ayosec/858810 to your computer and use it in GitHub Desktop.
# >---------------------------[ Install Command ]-----------------------------<
# rails new APP_NAME -m https://gist.github.com/raw/858810/gistfile1.rb -O -J
# >---------------------------------------------------------------------------<
#
# This template was based on http://railswizard.org
#
# >----------------------------[ Initial Setup ]------------------------------<
initializer 'generators.rb', <<-RUBY
Rails.application.config.generators do |g|
end
RUBY
template = {"orm"=>"mongoid", "unit_testing"=>"test_unit", "integration_testing"=>"on", "javascript"=>"jquery", "authentication"=>"", "templating"=>"haml", "css"=>"sass"}
recipes = template.values.flatten
def say_recipe(name); say "\033[36m" + "recipe".rjust(10) + "\033[0m" + " Running #{name} recipe..." end
def say_wizard(text); say "\033[36m" + "wizard".rjust(10) + "\033[0m" + " #{text}" end
@after_blocks = []
def after_bundler(&block); @after_blocks << block; end
# >--------------------------------[ Mongoid ]--------------------------------<
# Utilize MongoDB with Mongoid as the ORM.
say_recipe 'Mongoid'
gem "mongoid", "2.0.0.rc.7"
gem "bson_ext"
after_bundler do
generate 'mongoid:config'
end
# >--------------------------------[ jQuery ]---------------------------------<
# Adds the latest jQuery and Rails UJS helpers for jQuery.
say_recipe 'jQuery'
inside "public/javascripts" do
get "https://github.com/rails/jquery-ujs/raw/master/src/rails.js", "rails.js"
get "http://code.jquery.com/jquery-1.5.min.js", "jquery.js"
end
# >---------------------------------[ HAML ]----------------------------------<
# Utilize HAML for templating.
say_recipe 'HAML'
gem 'haml', '>= 3.0.0'
gem 'haml-rails'
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