# This file is for drying end easy maintain template for creating rails application with devise, mongoid and haml # Inspiration from http://gist.github.com/383499/ # To use this template, you need rails3, then run: # rails app_name -m http://gist.github.com/raw/407296/edge-mongoid-devise.rb #Gemfile apply "http://gist.github.com/raw/407296/edge-template-Gemfile.rb" # Bundle run 'bundle install --relock' # Initialize testing suite run 'script/rails g rspec:install' run 'script/rails g cucumber:skeleton --rspec --capybara' run 'script/rails g mongoid:config' #change layout to haml #apply "http://gist.github.com/raw/407296/haml-html5-layout.rb" #you can also use a bit more usefull layout, with user navigation for devise and css: apply "http://gist.github.com/raw/407296/haml-html5-layout-with-devise-and-css.rb" run "rm public/javascripts/*.js" run "curl -L http://github.com/rails/jquery-ujs/raw/master/src/rails.js > public/javascripts/rails.js" #generators config config = <<-CONFIG config.generators do |g| g.orm :mongoid g.template_engine :haml g.test_framework :rspec, :fixture => false end CONFIG file 'lib/tasks/mongo.rake', <<-RAKE namespace :db do namespace :test do task :prepare do # Stub out for MongoDB end end end RAKE inject_into_file 'config/application.rb', "#{config}", :after => "# end\n", :verbose => true database_flushing = <<-RSPEC config.before(:each) do Mongoid.master.collections.each(&:drop) end RSPEC inject_into_file 'spec/spec_helper', database_flushing, :after => "Rspec.configure do |config|\n", :verbose => true #devise config apply "http://gist.github.com/raw/407296/devise-with-mongoid-configuration.rb" # Remove index.html, application.html.erb and rails.png run "rm public/index.html" run "rm public/images/rails.png" run "rm app/views/layouts/application.html.erb" # Remove test directory since we're not using test/unit run "rm -rf test" # Creates Main controller with route root apply "http://gist.github.com/raw/407296/main-controller.rb"