Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extend doorkeeper 3 with its extracted ORMs
doorkeeper 3 has not been released yet, and will be when its ORMs are successfully extracted and tested into this project. This PR extends doorkeeper with the ORM specifics for mongoid and mongomapper. To test it, it loads doorkeeper as a submodule, copy its test suite into this project, configures the ORMs according to the matrix defined in `.travis.yml` file, and run the test suite with each.
- Loading branch information
Showing
81 changed files
with
302 additions
and
1,404 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,4 @@ spec/generators/tmp | |
.rvmrc | ||
*.swp | ||
.idea | ||
spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "doorkeeper"] | ||
path = doorkeeper | ||
url = https://github.com/doorkeeper-gem/doorkeeper.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,6 @@ LineLength: | |
|
||
StringLiterals: | ||
Enabled: false | ||
|
||
TrailingBlankLines: | ||
Enabled: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,41 @@ | ||
language: ruby | ||
sudo: false | ||
cache: bundler | ||
|
||
rvm: | ||
- 1.9.3 | ||
- 2.0 | ||
- 2.1 | ||
- 2.2 | ||
|
||
env: | ||
- orm=mongoid2 | ||
- orm=mongoid3 | ||
- orm=mongoid4 | ||
- orm=mongo_mapper | ||
- rails=3.2.0 | ||
- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Contributing | ||
|
||
We love pull requests from everyone. By participating in this project, you agree | ||
to abide by the thoughtbot [code of conduct]. | ||
|
||
[code of conduct]: https://thoughtbot.com/open-source-code-of-conduct | ||
|
||
Fork, then clone the repo: | ||
|
||
git clone git@github.com:your-username/doorkeeper-orms.git | ||
|
||
Set up Ruby dependencies via Bundler | ||
|
||
bundle install | ||
|
||
Make sure the tests pass: | ||
|
||
rake | ||
|
||
Make your change. | ||
Write tests. | ||
Follow our [style guide][style]. | ||
Make the tests pass: | ||
|
||
[style]: https://github.com/thoughtbot/guides/tree/master/style | ||
|
||
rake | ||
|
||
Write a [good commit message][commit]. | ||
Push to your fork. | ||
[Submit a pull request][pr]. | ||
|
||
[commit]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html | ||
[pr]: https://github.com/doorkeeper-gem/doorkeeper-orms/compare/ | ||
|
||
If [Hound] catches style violations, | ||
fix them. | ||
|
||
[hound]: https://houndci.com | ||
|
||
Wait for us. | ||
We try to at least comment on pull requests within one business day. | ||
We may suggest changes. | ||
|
||
Thank you for your contribution! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,8 @@ | ||
source "https://rubygems.org" | ||
ENV['rails'] ||= '4.2.0' | ||
|
||
gem 'doorkeeper', github: 'jasl/doorkeeper', branch: 'extract-orm-specifics' | ||
source 'https://rubygems.org' | ||
|
||
# Defaults. For supported versions check .travis.yml | ||
ENV['orm'] ||= 'mongoid4' | ||
ENV['rails'] ||= ENV['orm'] == 'mongoid4' ? '~> 4.1.2' : '~> 3.2.13' | ||
|
||
gem 'rails', ENV['rails'] | ||
|
||
case ENV['orm'] | ||
when 'active_record' | ||
gem 'activerecord' | ||
|
||
when 'mongoid2' | ||
gem 'mongoid', '~> 2' | ||
|
||
when 'mongoid3' | ||
gem 'mongoid', '~> 3' | ||
|
||
when 'mongoid4' | ||
gem 'mongoid', '~> 4' | ||
|
||
when 'mongo_mapper' | ||
gem 'mongo_mapper', '~> 0' | ||
end | ||
gem 'rails', "~> #{ENV['rails']}" | ||
gem "doorkeeper" | ||
|
||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,54 @@ | ||
# Doorkeeper bundle | ||
# doorkeeper-orms extension | ||
|
||
==== | ||
## Installation | ||
|
||
Doorkeeper's extracted ORM specifics. | ||
doorkeeper-orms provides doorkeeper support to MongoMapper, Mongoid 2, 3 and 4. | ||
To start using it, add to your Gemfile: | ||
|
||
including: | ||
``` ruby | ||
gem 'doorkeeper-orms' | ||
``` | ||
|
||
- Mongoid2 | ||
- Mongoid3 | ||
- Mongoid4 | ||
- Mongo mapper | ||
Run [doorkeeper’s installation generator]: | ||
|
||
### License | ||
rails generate doorkeeper:install | ||
|
||
MIT. | ||
[doorkeeper’s installation generator]: https://github.com/doorkeeper-gem/doorkeeper#installation | ||
|
||
This will install the doorkeeper initializer into | ||
`config/initializers/doorkeeper.rb`. | ||
|
||
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 | ||
|
||
Generate the `db/indexes.rb` file and create indexes for the doorkeeper models: | ||
|
||
rails generate doorkeeper:mongo_mapper:indexes | ||
rake db:index | ||
|
||
|
||
## Tests | ||
|
||
To run tests, clone this repository and run `rake`. It will copy and run | ||
doorkeeper’s original test suite, after configuring the ORM according to the | ||
variables defined in `.travis.yml` file. | ||
|
||
|
||
--- | ||
|
||
Please refer to https://github.com/doorkeeper-gem/doorkeeper for instructions on | ||
doorkeeper’s project. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,28 @@ | ||
begin | ||
require 'bundler/setup' | ||
rescue LoadError | ||
puts 'You must `gem install bundler` and `bundle install` to run rake tasks' | ||
end | ||
|
||
require 'bundler/setup' | ||
require 'rspec/core/rake_task' | ||
|
||
require 'rdoc/task' | ||
desc 'Default: run specs.' | ||
task :default => :spec | ||
|
||
RDoc::Task.new(:rdoc) do |rdoc| | ||
rdoc.rdoc_dir = 'rdoc' | ||
rdoc.title = 'DoorkeeperOrms' | ||
rdoc.options << '--line-numbers' | ||
rdoc.rdoc_files.include('lib/**/*.rb') | ||
task :load_doorkeeper do | ||
`git submodule init` | ||
`git submodule update` | ||
`cp -r doorkeeper/spec .` | ||
`bundle exec rspec` | ||
end | ||
|
||
Bundler::GemHelper.install_tasks | ||
RSpec::Core::RakeTask.new(:spec) do |config| | ||
config.verbose = false | ||
end | ||
|
||
desc "Run all specs" | ||
RSpec::Core::RakeTask.new(:spec) | ||
Rake::Task["spec"].enhance [:load_doorkeeper] | ||
|
||
desc 'Default: run specs.' | ||
task :default => :spec | ||
namespace :doorkeeper do | ||
desc "Install doorkeeper in dummy app" | ||
task :install do | ||
cd 'spec/dummy' | ||
system 'bundle exec rails g doorkeeper:install --force' | ||
end | ||
end | ||
|
||
Bundler::GemHelper.install_tasks |
Submodule doorkeeper
added at
0b0031
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
ENV['rails'] ||= '4.2.0' | ||
|
||
source 'https://rubygems.org' | ||
|
||
gem 'rails', "~> #{ENV['rails']}" | ||
gem "doorkeeper" | ||
|
||
gemspec path: '../' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
gemfile = 'gemfiles/Gemfile.common.rb' | ||
instance_eval IO.read(gemfile), gemfile | ||
|
||
gem 'mongo_mapper' | ||
gem 'bson_ext' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
gemfile = 'gemfiles/Gemfile.common.rb' | ||
instance_eval IO.read(gemfile), gemfile | ||
|
||
gem 'mongoid', '~> 2' | ||
gem 'bson_ext' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
gemfile = 'gemfiles/Gemfile.common.rb' | ||
instance_eval IO.read(gemfile), gemfile | ||
|
||
gem 'mongoid', '~> 3' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
gemfile = 'gemfiles/Gemfile.common.rb' | ||
instance_eval IO.read(gemfile), gemfile | ||
|
||
gem 'mongoid', '~> 4' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module DoorkeeperOrms | ||
VERSION = "0.0.1" | ||
VERSION = "3.0.0" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.