<commit_before># Doorkeeper - awesome oauth provider for your Rails app.

[![Build Status](https://secure.travis-ci.org/applicake/doorkeeper.png)](http://travis-ci.org/applicake/doorkeeper)
[![Dependency Status](https://gemnasium.com/applicake/doorkeeper.png)](https://gemnasium.com/applicake/doorkeeper)
[![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/applicake/doorkeeper)

Doorkeeper is a gem that makes it easy to introduce OAuth 2 provider functionality to your application.

The gem is under constant development. It is based in the [version 22 of the OAuth specification](http://tools.ietf.org/html/draft-ietf-oauth-v2-22) and it still does not support all OAuth features.

For more information about the supported features, check out the related [page in the wiki](https://github.com/applicake/doorkeeper/wiki/Supported-Features). For more information about OAuth 2 go to [OAuth 2 Specs (Draft)](http://tools.ietf.org/html/draft-ietf-oauth-v2-22).

## Requirements

### Ruby

- 1.8.7, 1.9.2 or 1.9.3

### Rails

- 3.1.x or 3.2.x

### ORM

- ActiveRecord
- Mongoid 2 (only for doorkeeper v0.5+)
- MongoMapper git HEAD (only for doorkeeper v0.5+)

## Installation

Put this in your Gemfile:

``` ruby
gem 'doorkeeper', '~> 0.4.2'
```

Run the installation generator with:

    rails generate doorkeeper:install

This will install the doorkeeper initializer into `config/initializers/doorkeeper.rb`.

## Configuration

### Active Record

By default doorkeeper is configured to use active record, so to start you have to generate the migration tables:

    rails generate doorkeeper:migration

Don't forget to run the migration with:

    rake db:migrate

### Mongoid (only doorkeeper v0.5+)

Doorkeeper currently supports Mongoid 2. To start using it, you have to set the `orm` configuration:

``` ruby
Doorkeeper.configure do
  orm :mongoid
end
```

**Note:** Make sure you create indexes for doorkeeper models. You can do this either by running `db:mongoid:create_indexes`
or by adding `autocreate_indexes: true` to your `config/mongoid.yml`

### MongoMapper (only doorkeeper v0.5+)

Doorkeeper currently supports MongoMapper git HEAD. To start using it, you have to set the `orm` configuration:

``` ruby
Doorkeeper.configure do
  orm :mongo_mapper
end
```

**Note:** Make sure you create indexes for doorkeeper models. You can do this by running `rake db:index`.

### Routes

The installation script will also automatically add the Doorkeeper routes into your app, like this:
<commit_msg>Updating the main README with new MongoMapper installation instructions<commit_after># Doorkeeper - awesome oauth provider for your Rails app.

[![Build Status](https://secure.travis-ci.org/applicake/doorkeeper.png)](http://travis-ci.org/applicake/doorkeeper)
[![Dependency Status](https://gemnasium.com/applicake/doorkeeper.png)](https://gemnasium.com/applicake/doorkeeper)
[![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/applicake/doorkeeper)

Doorkeeper is a gem that makes it easy to introduce OAuth 2 provider functionality to your application.

The gem is under constant development. It is based in the [version 22 of the OAuth specification](http://tools.ietf.org/html/draft-ietf-oauth-v2-22) and it still does not support all OAuth features.

For more information about the supported features, check out the related [page in the wiki](https://github.com/applicake/doorkeeper/wiki/Supported-Features). For more information about OAuth 2 go to [OAuth 2 Specs (Draft)](http://tools.ietf.org/html/draft-ietf-oauth-v2-22).

## Requirements

### Ruby

- 1.8.7, 1.9.2 or 1.9.3

### Rails

- 3.1.x or 3.2.x

### ORM

- ActiveRecord
- Mongoid 2 (only for doorkeeper v0.5+)
- MongoMapper git HEAD (only for doorkeeper v0.5+)

## Installation

Put this in your Gemfile:

``` ruby
gem 'doorkeeper', '~> 0.4.2'
```

Run the installation generator with:

    rails generate doorkeeper:install

This will install the doorkeeper initializer into `config/initializers/doorkeeper.rb`.

## Configuration

### Active Record

By default doorkeeper is configured to use active record, so to start you have to generate the migration tables:

    rails generate doorkeeper:migration

Don't forget to run the migration with:

    rake db:migrate

### Mongoid (only doorkeeper v0.5+)

Doorkeeper currently supports Mongoid 2. To start using it, you have to set the `orm` configuration:

``` ruby
Doorkeeper.configure do
  orm :mongoid
end
```

**Note:** Make sure you create indexes for doorkeeper models. You can do this either by running `db:mongoid:create_indexes`
or by adding `autocreate_indexes: true` to your `config/mongoid.yml`

### MongoMapper (only doorkeeper v0.5+)

Doorkeeper currently supports MongoMapper git HEAD. To start using it, you have to set the `orm` configuration:

``` ruby
Doorkeeper.configure do
  orm :mongo_mapper
end
```

Then generate the `db/indexes.rb` file and create indexes for the doorkeeper models:

    rails generate doorkeeper:mongo_mapper:indexes
    rake db:index

### Routes

The installation script will also automatically add the Doorkeeper routes into your app, like this:

{'fraction_non_alphanumeric': 0.10400154649139765, 'fraction_numerical': 0.014305045428184806, 'mean_word_length': 4.539614561027837, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 12, 'lorem ipsum': 0, 'www.': 0, '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': '435106', 'n_tokens_mistral': 1659, 'n_tokens_neox': 1542, 'n_words': 570}