Description:

This generator will build the code for devise and any necessary requirements such as cancan, warden, oauth.

Options for devise include:
1.  Database Authenticatable: encrypts and stores a password in the database to validate the authenticity of an user while signing in. The authentication can be done both through POST requests or HTTP Basic Authentication.
2.  Token Authenticatable: signs in an user based on an authentication token (also known as “single access token”). The token can be given both through query string or HTTP Basic Authentication.
3.  Oauthable: adds OAuth2 support
4.  Confirmable: sends emails with confirmation instructions and verifies whether an account is already confirmed during sign in.
5.  Recoverable: resets the user password and sends reset instructions.
6.  Registerable: handles signing up users through a registration process, also allowing them to edit and destroy their account.
7.  Rememberable: manages generating and clearing a token for remembering the user from a saved cookie.
8.  Trackable: tracks sign in count, timestamps and IP address.
9.  Timeoutable: expires sessions that have no activity in a specified period of time.
10. Validatable: provides validations of email and password. It’s optional and can be customized, so you’re able to define your own validations.
11. Lockable: locks an account after a specified number of failed sign-in attempts. Can unlock via email or after a specified time period.

More runtime options:
  Runtime options:
    -c, [--config]    # Configuration Options for devise. ie 1,2,3,7,11
    -t, [--twitteroauth]    # Twitter Oauth key and secret seperated by , (comma). ie 123lk23jjsdfklsd,2l4kljknsdjlsdf
    -o, [--facebookoauth]    # Facebook Oauth key, secret and client_id seperated by , (comma). ie 123lk23jjsdfklsd,2l4kljknsdjlsdf,102092932
    -g, [--gems]      # Version of the gems you want to use seperated by Devise,Warden,Cancan. ie 1.1.5,0.1.1,1.5.1  
    -d, [--denied]        # add this option if you want to add a customized permission denied message
    -e, [--extra]         # Extra fields added to the user model. ie first_name:string,last_name:string  
    -n, [--new]           # If the project is brand new.  Will remove the index.html and add the root route
    -s, [--sudo]          # Use sudo for the gem install commands (for non rvm/osx users)
    -u, [--url]           # Rool url for your app in development
    -C, [--cucumber]      # Include cucumber tests, currently does not support oauth

Things you still need to update after you run this:
  - Add the before filter to each controller.
    - You can find an example in the applications controller.  Remove from the applications controller.
  - Clean up the users model.
  - If you have not done so, remove the index.html and add a root route to your routes.rb file
  - Move the login/logout links
    - I added them to layouts/application.html.erb
  - Fix the navigation
    - I added the partial to layouts/application.html.erb
  - If you don't have flash notices you need to add them in your layout

Examples:

twitter oauth:

  rails generate devisable -c 2,3 -t asdf489fhkbnajbsdf,2uh3uh383493hkjdf -g 1.1.5,0.1.1,1.5.1 -r -d  -e first_name:string,last_name:string -u http://dev.yoururl.com

facebook oauth: 

  rails generate devisable -c 2,3 -o asdf489fhkbnajbsdf,2uh3uh383493hkjdf,10201020202 -g 1.1.5,0.1.1,1.5.1 -r -d  -e first_name:string,last_name:string -u http://dev.yoururl.com

No oauth:

  rails generate devisable -c 1,4,5,7,8,10 -g 1.1.5,0.1.1,1.5.1 -r -d -e first_name:string,last_name:string

Default run is:

  rails generate devisable -c 1,4,5,7,8,10