Skip to content

Instantly share code, notes, and snippets.

@vquaiato
Forked from mborromeo/rails-3-mongo-devise.rb
Created June 23, 2011 23:43
Show Gist options
  • Save vquaiato/1043910 to your computer and use it in GitHub Desktop.
Save vquaiato/1043910 to your computer and use it in GitHub Desktop.
Rails 3 Master + MongoDB + Devise template
# This Rails template will generate a Rails 3 (MASTER) application, with MongoDB as ORM and Devise for authentication.
# You will require ruby 1.9.2-HEAD to run generated app.
file 'Gemfile', <<-GEMS
source 'http://gemcutter.org'
gem 'rails'
gem "mongoid"
gem "bson_ext"
gem "inherited_resources"
gem "devise", :git => "git://github.com/plataformatec/devise.git"
GEMS
run 'bundle install'
file 'config/database.yml', <<-CODE
CODE
config = <<-CONFIG
config.generators do |g|
g.orm :mongoid
end
CONFIG
inject_into_file 'config/application.rb', "#{config}", :after => "# end\n", :verbose => true
gsub_file 'config/application.rb', "require 'rails/all'" ,"# require 'active_record/railtie'\nrequire 'action_controller/railtie'\nrequire 'action_mailer/railtie'\nrequire 'active_resource/railtie'\nrequire 'rails/test_unit/railtie'"
run 'script/rails g mongoid:config'
run 'script/rails g devise:install'
run 'script/rails g devise User'
inject_into_file 'config/routes.rb', 'root :to => "changeme#asap"', :after => "devise_for :users\n", :verbose => true
run "rm public/index.html"
run "rm public/images/rails.png"
puts "\n\n - Initial auth app is at /users/sign_in\n - Remember to change root controller into routes\n - happy coding :)\n\n\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment