Skip to content

Instantly share code, notes, and snippets.

@bjfish
Created October 26, 2010 15:37
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 bjfish/647128 to your computer and use it in GitHub Desktop.
Save bjfish/647128 to your computer and use it in GitHub Desktop.
# >---------------------------[ Install Command ]-----------------------------<
# rails new APP_NAME -m http://railswizard.org/187c364beba62d244b66.rb -J -O -T
# >---------------------------------------------------------------------------<
#
# _____ _ _ __ ___ _
# | __ \ (_) | \ \ / (_) | |
# | |__) |__ _ _| |___\ \ /\ / / _ ______ _ _ __ __| |
# | _ // _` | | / __|\ \/ \/ / | |_ / _` | '__/ _` |
# | | \ \ (_| | | \__ \ \ /\ / | |/ / (_| | | | (_| |
# |_| \_\__,_|_|_|___/ \/ \/ |_/___\__,_|_| \__,_|
#
# This template was generated by RailsWizard, the amazing and awesome Rails
# application template builder. Get started at http://railswizard.org
#
# ___________________________________________________________________________
# |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/|
# | | |
# | Name: | migrate |
# | URL: | http://railswizard.org/187c364beba62d244b66.rb |
# | Updated: | October 26, 2010 at 14:03PM |
# | | |
# |\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\|
# ---------------------------------------------------------------------------
# >----------------------------[ Initial Setup ]------------------------------<
initializer 'generators.rb', <<-RUBY
Rails.application.config.generators do |g|
end
RUBY
template = {"authentication"=>"devise", "templating"=>"haml", "unit_testing"=>"rspec", "css"=>"sass", "javascript"=>"jquery", "integration_testing"=>"on", "orm"=>"mongo_mapper"}
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
# >------------------------------[ MongoMapper ]------------------------------<
# Use MongoDB with MongoMapper as your primary datastore.
say_recipe 'MongoMapper'
gem 'bson_ext'
gem 'mongo_mapper', :git => 'git://github.com/jnunemaker/mongomapper.git', :branch => 'rails3'
after_bundler do
generate 'mongo_mapper:config'
end
# >---------------------------------[ RSpec ]---------------------------------<
# Use RSpec for unit testing for this Rails app.
say_recipe 'RSpec'
gem 'rspec-rails', '>= 2.0.1', :group => [:development, :test]
inject_into_file "config/initializers/generators.rb", :after => "Rails.application.config.generators do |g|\n" do
" g.test_framework = :rspec\n"
end
after_bundler do
generate 'rspec:install'
end
# >--------------------------------[ jQuery ]---------------------------------<
# Adds the latest jQuery and Rails UJS helpers for jQuery.
say_recipe '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-1.4.2.min.js", "jquery/jquery.min.js"
end
application do
"\n config.action_view.javascript_expansions[:defaults] = %w(jquery.min rails)\n"
end
gsub_file "config/application.rb", /# JavaScript.*\n/, ""
gsub_file "config/application.rb", /# config\.action_view\.javascript.*\n/, ""
# >--------------------------------[ Devise ]---------------------------------<
# Utilize Devise for authentication, automatically configured for your selected ORM.
say_recipe 'Devise'
gem 'devise'
after_bundler do
generate 'devise:install'
case template['orm']
when 'mongo_mapper'
gem 'mm-devise'
gsub_file 'config/intializers/devise.rb', 'devise/orm/active_record', 'devise/orm/mongo_mapper_active_model'
when 'mongoid'
gsub_file 'config/intializers/devise.rb', 'devise/orm/active_record', 'devise/orm/mongoid'
when 'active_record'
# Nothing to do
end
generate 'devise user'
end
# >---------------------------------[ HAML ]----------------------------------<
# Utilize HAML for templating.
say_recipe 'HAML'
gem 'haml', '>= 3.0.0'
gem 'haml-rails'
# >---------------------------------[ SASS ]----------------------------------<
# Utilize SASS (through the HAML gem) for really awesome stylesheets!
say_recipe 'SASS'
unless recipes.include? 'haml'
gem 'haml', '>= 3.0.0'
end
# >-----------------------------[ Run Bundler ]-------------------------------<
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