<commit_before>h1. Clearance

Rails authentication with email & password.

"We have clearance, Clarence.":http://www.youtube.com/v/mNRXJEE3Nz8

h2. Wiki

Most information regarding Clearance is on the "Github Wiki":http://wiki.github.com/thoughtbot/clearance.

h2. Engine

Clearance is a Rails engine. It works with versions of Rails greater than 2.3.

In config/environment.rb:

<pre>
config.gem "thoughtbot-clearance", 
  :lib     => 'clearance', 
  :source  => 'http://gems.github.com', 
  :version => '0.6.6'
</pre>

Vendor the gem:

<pre>
rake gems:install
rake gems:unpack
</pre>

Make sure the development database exists and run the generator:

@script/generate clearance@

A number of files will be created and instructions will be printed.

You may already have some of these files. Don't worry. You'll be asked if you want to overwrite them.

Run the migration:

@rake db:migrate@

h2. Environment

Define a HOST constant in your environment files.
In config/environments/test.rb and config/environments/development.rb it can be:

@HOST = "localhost"@

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>"@

Define root_url to *something* in your config/routes.rb:

@map.root :controller => 'home'@

h2. Cucumber Features

As your app evolves, you want to know that authentication still works. Clearance's opinion is that you should test its integration with your app using "Cucumber":http://cukes.info/.

In config/environments/test.rb:

<pre>
config.gem 'webrat',
  :version => '= 0.4.4'
config.gem 'cucumber',
  :version => '= 0.3.0'
config.gem 'thoughtbot-factory_girl',
  :lib     => 'factory_girl',
  :source  => "http://gems.github.com", 
  :version => '1.2.1'
</pre>

Vendor the gems:

<pre>
rake gems:install RAILS_ENV=test
rake gems:unpack  RAILS_ENV=test
</pre>

Don't vendor nokogiri (due to its native extensions):

@rm -rf vendor/gems/nokogiri-1.2.3@

Run the Cucumber generator (if you haven't already) and Clearance's feature generator:

<pre>
script/generate cucumber
script/generate clearance_features
</pre>

All of the files generated should be new with the exception of the features/support/paths.rb file. If you have not modified your paths.rb then you will be okay to replace it with this one. If you need to keep your paths.rb file then add these locations in your paths.rb manually:

<pre>
def path_to(page_name)
  case page_name
   ...
  when /the sign up page/i
   new_user_path
  when /the sign in page/i
   new_session_path
  when /the password reset request page/i
   new_password_path
  ...
end
</pre>

h2. Authors

Clearance was extracted out of "Hoptoad":http://hoptoadapp.com. We merged the authentication code from two of thoughtbot's client's Rails apps and have since used it each time we need authentication. The following people have improved the library. Thank you!

<NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, & <NAME>.

h2. Questions?

Ask the "mailing list":http://groups.google.com/group/thoughtbot-clearance

h2. Suggestions, Bugs, Refactoring?

Fork away and create a "Github Issue":http://github.com/thoughtbot/clearance/issues. Please don't send pull requests.
<commit_msg>improvements to the installation instructions. added <NAME> & <NAME> to list of people who have improved the library.<commit_after>h1. Clearance

Rails authentication with email & password.

"We have clearance, Clarence.":http://www.youtube.com/v/mNRXJEE3Nz8

h2. Wiki

Most information regarding Clearance is on the "Github Wiki":http://wiki.github.com/thoughtbot/clearance.

h2. Installation

Clearance is a Rails engine. It works with versions of Rails greater than 2.3.

In config/environment.rb:

<pre>
config.gem "thoughtbot-clearance", 
  :lib     => 'clearance', 
  :source  => 'http://gems.github.com', 
  :version => '0.6.6'
</pre>

Vendor the gem:

<pre>
rake gems:install
rake gems:unpack
</pre>

Make sure the development database exists and run the generator:

@script/generate clearance@

A number of files will be created and instructions will be printed.

You may already have some of these files. Don't worry. You'll be asked if you want to overwrite them.

Run the migration:

@rake db:migrate@

Define a HOST constant in your environment files.
In config/environments/test.rb and config/environments/development.rb it can be:

@HOST = "localhost"@

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>"@

Define root_url to *something* in your config/routes.rb:

@map.root :controller => 'home'@

h2. Cucumber Features

As your app evolves, you want to know that authentication still works. Clearance's opinion is that you should test its integration with your app using "Cucumber":http://cukes.info/.

In config/environments/test.rb:

<pre>
config.gem 'webrat',
  :version => '= 0.4.4'
config.gem 'cucumber',
  :version => '= 0.3.0'
config.gem 'thoughtbot-factory_girl',
  :lib     => 'factory_girl',
  :source  => "http://gems.github.com", 
  :version => '1.2.1'
</pre>

Vendor the gems:

<pre>
rake gems:install RAILS_ENV=test
rake gems:unpack  RAILS_ENV=test
</pre>

We don't vendor nokogiri due to its native extensions, so install it normally on your machine:

@sudo gem install nokogiri@

Run the Cucumber generator (if you haven't already) and Clearance's feature generator:

<pre>
script/generate cucumber
script/generate clearance_features
</pre>

All of the files generated should be new with the exception of the features/support/paths.rb file. If you have not modified your paths.rb then you will be okay to replace it with this one. If you need to keep your paths.rb file then add these locations in your paths.rb manually:

<pre>
def path_to(page_name)
  case page_name
   ...
  when /the sign up page/i
   new_user_path
  when /the sign in page/i
   new_session_path
  when /the password reset request page/i
   new_password_path
  ...
end
</pre>

h2. Authors

Clearance was extracted out of "Hoptoad":http://hoptoadapp.com. We merged the authentication code from two of thoughtbot's clients' Rails apps and have since used it each time we need authentication. The following people have improved the library. Thank you!

<NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME> & <NAME>.

h2. Questions?

Ask the "mailing list":http://groups.google.com/group/thoughtbot-clearance

h2. Suggestions, Bugs, Refactoring?

Fork away and create a "Github Issue":http://github.com/thoughtbot/clearance/issues. Please don't send pull requests.

{'fraction_non_alphanumeric': 0.10683447973071857, 'fraction_numerical': 0.0073174301185423675, 'mean_word_length': 4.149962321024868, 'pattern_counts': {'":': 12, '<': 65, '<?xml version=': 0, '>': 83, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6046166', 'n_tokens_mistral': 2242, 'n_tokens_neox': 2150, 'n_words': 835}