Skip to content

Instantly share code, notes, and snippets.

@lgs
Created June 9, 2009 21:14
Show Gist options
  • Save lgs/126791 to your computer and use it in GitHub Desktop.
Save lgs/126791 to your computer and use it in GitHub Desktop.
############################################################
# #
# Out of the box Clearance Rails authentication tamplate #
# basically follow the wiki installation guide @ github #
# http://wiki.github.com/thoughtbot/clearance/installation #
# #
# Build the complete skeleton for a Rails 2.3 application #
# using Clearance Auth. This generator will automatically #
# build the basics for a Rails authentication with email #
# and password. #
# #
############################################################
# Add clearance gem to config/environment.rb
gem "thoughtbot-clearance",
:lib => 'clearance',
:source => 'http://gems.github.com'
# Vendor the gem
rake "gems:install", :sudo => true
rake "gems:unpack"
# Create a development/test/prod database
inside ('') do
run 'rake rails:template LOCATION=http://github.com/lgs/rails-templates/raw/master/MySQL-DB-creator'
end
# Run the generator
generate :clearance
# Define a HOST constant in your environment files.
# In config/environments/test.rb and config/environments/development.rb
# it can be: HOST = "localhost"
environment "\r\n\r\n# clearance\r\nHOST = 'localhost'", :env => 'test'
environment "\r\n\r\n# clearance\r\nHOST = 'localhost'", :env => 'development'
# In production.rb it must be the actual host your application is deployed to.
# The constant is used by mailers to generate URLs in emails.
# In config/environment.rb: DO_NOT_REPLY = "[email protected]"
domain = ask("\nWhat domain will this application run under?")
environment "\r\n\r\n# clearance\r\nHOST = \"#{domain}\"", :env => 'production'
append_file 'config/environment.rb', "\r\n\r\n# clearance\r\nDO_NOT_REPLY = 'donotreply@#{domain}'\r\n"
# Define root_url in config/routes.rb
generate :controller, "home", "index"
route "map.root :controller => 'home'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment