Skip to content

Commit

Permalink
Extract ORMs from doorkeeper
Browse files Browse the repository at this point in the history
This PR removes doorkeeper ORM specifics, in favor of extending it with
other rubygems.

The specs defined in this project are still considered canonical, and
the goal is for extension rubygems to set doorkeeper as a git submodule,
and running its test suite against the specific ORM that is being
extended.

See doorkeeper-gem/doorkeeper-mongodb#2
  • Loading branch information
tute committed May 5, 2015
1 parent 365c10e commit 0b0031e
Show file tree
Hide file tree
Showing 33 changed files with 6 additions and 656 deletions.
23 changes: 0 additions & 23 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,7 @@ env:
- rails=4.1.0
- rails=4.2.0

gemfile:
- Gemfile
- gemfiles/Gemfile.mongoid2.rb
- gemfiles/Gemfile.mongoid3.rb
- gemfiles/Gemfile.mongoid4.rb
- gemfiles/Gemfile.mongo_mapper.rb

services:
- mongodb

matrix:
exclude:
- env: rails=3.2.0
rvm: 2.2

- gemfile: gemfiles/Gemfile.mongoid2.rb
env: rails=4.1.0
- gemfile: gemfiles/Gemfile.mongoid2.rb
env: rails=4.2.0

- gemfile: gemfiles/Gemfile.mongoid3.rb
env: rails=4.1.0
- gemfile: gemfiles/Gemfile.mongoid3.rb
env: rails=4.2.0

- gemfile: gemfiles/Gemfile.mongoid4.rb
env: rails=3.2.0
36 changes: 5 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,10 @@ https://github.com/doorkeeper-gem/doorkeeper/releases.
## Table of Contents

- [Useful links](#useful-links)
- [Requirements](#requirements)
- [Installation](#installation)
- [Configuration](#configuration)
- [Active Record](#active-record)
- [Mongoid / MongoMapper](#mongoid--mongomapper)
- [Mongoid indexes](#mongoid-indexes)
- [MongoMapper indexes](#mongomapper-indexes)
- [Other ORMs](#other-orms)
- [Routes](#routes)
- [Authenticating](#authenticating)
- [Internationalization (I18n)](#internationalization-i18n)
Expand Down Expand Up @@ -55,12 +52,6 @@ https://github.com/doorkeeper-gem/doorkeeper/releases.
- For documentation, please check out our [wiki](https://github.com/doorkeeper-gem/doorkeeper/wiki)
- For general questions, please post it in [stack overflow](http://stackoverflow.com/questions/tagged/doorkeeper)

## Requirements

- Ruby >= 2.0.0
- Rails >= 3.2
- ORM ActiveRecord, Mongoid, MongoMapper

## Installation

Put this in your Gemfile:
Expand Down Expand Up @@ -88,29 +79,12 @@ Don't forget to run the migration with:

rake db:migrate

### Mongoid / MongoMapper

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

``` ruby
Doorkeeper.configure do
orm :mongoid2 # or :mongoid3, :mongoid4, :mongo_mapper
end
```

#### Mongoid indexes

Make sure you create indexes for doorkeeper models. You can do this either by
running `rake db:mongoid:create_indexes` or (if you're using Mongoid 2) by
adding `autocreate_indexes: true` to your `config/mongoid.yml`

#### MongoMapper indexes
### Other ORMs

Generate the `db/indexes.rb` file and create indexes for the doorkeeper models:
See [doorkeeper-orms project] for mongoid and mongomapper support. Follow along
the implementation in that repository to extend doorkeeper with other ORMs.

rails generate doorkeeper:mongo_mapper:indexes
rake db:index
[doorkeeper-orms project]: https://github.com/doorkeeper-gem/doorkeeper-orms

### Routes

Expand Down
32 changes: 1 addition & 31 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,36 +14,6 @@ en:
relative_uri: 'must be an absolute URI.'
secured_uri: 'must be an HTTPS/SSL URI.'

mongoid:
attributes:
doorkeeper/application:
name: 'Name'
redirect_uri: 'Redirect URI'
errors:
models:
doorkeeper/application:
attributes:
redirect_uri:
fragment_present: 'cannot contain a fragment.'
invalid_uri: 'must be a valid URI.'
relative_uri: 'must be an absolute URI.'
secured_uri: 'must be an HTTPS/SSL URI.'

mongo_mapper:
attributes:
doorkeeper/application:
name: 'Name'
redirect_uri: 'Redirect URI'
errors:
models:
doorkeeper/application:
attributes:
redirect_uri:
fragment_present: 'cannot contain a fragment.'
invalid_uri: 'must be a valid URI.'
relative_uri: 'must be an absolute URI.'
secured_uri: 'must be an HTTPS/SSL URI.'

doorkeeper:
applications:
confirmations:
Expand Down Expand Up @@ -148,4 +118,4 @@ en:
oauth2_provider: 'OAuth2 Provider'
applications: 'Applications'
application:
title: 'OAuth authorize required'
title: 'OAuth authorize required'
1 change: 0 additions & 1 deletion doorkeeper.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,5 @@ Gem::Specification.new do |s|
s.add_development_dependency "timecop", "~> 0.7.0"
s.add_development_dependency "database_cleaner", "~> 1.3.0"
s.add_development_dependency "rspec-activemodel-mocks", "~> 1.0.0"
s.add_development_dependency "bcrypt-ruby", "~> 3.0.1"
s.add_development_dependency "pry", "~> 0.10.0"
end
7 changes: 0 additions & 7 deletions gemfiles/Gemfile.common.rb

This file was deleted.

5 changes: 0 additions & 5 deletions gemfiles/Gemfile.mongo_mapper.rb

This file was deleted.

5 changes: 0 additions & 5 deletions gemfiles/Gemfile.mongoid2.rb

This file was deleted.

4 changes: 0 additions & 4 deletions gemfiles/Gemfile.mongoid3.rb

This file was deleted.

4 changes: 0 additions & 4 deletions gemfiles/Gemfile.mongoid4.rb

This file was deleted.

4 changes: 0 additions & 4 deletions lib/doorkeeper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@
require 'doorkeeper/rails/helpers'

require 'doorkeeper/orm/active_record'
require 'doorkeeper/orm/mongo_mapper'
require 'doorkeeper/orm/mongoid2'
require 'doorkeeper/orm/mongoid3'
require 'doorkeeper/orm/mongoid4'

module Doorkeeper
def self.configured?
Expand Down

This file was deleted.

This file was deleted.

19 changes: 0 additions & 19 deletions lib/doorkeeper/orm/mongo_mapper.rb

This file was deleted.

24 changes: 0 additions & 24 deletions lib/doorkeeper/orm/mongo_mapper/access_grant.rb

This file was deleted.

43 changes: 0 additions & 43 deletions lib/doorkeeper/orm/mongo_mapper/access_token.rb

This file was deleted.

32 changes: 0 additions & 32 deletions lib/doorkeeper/orm/mongo_mapper/application.rb

This file was deleted.

19 changes: 0 additions & 19 deletions lib/doorkeeper/orm/mongoid2.rb

This file was deleted.

22 changes: 0 additions & 22 deletions lib/doorkeeper/orm/mongoid2/access_grant.rb

This file was deleted.

Loading

0 comments on commit 0b0031e

Please sign in to comment.