Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend doorkeeper; run its specs in this extension gem #2

Merged
merged 2 commits into from
May 12, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ spec/generators/tmp
.rvmrc
*.swp
.idea
spec
3 changes: 3 additions & 0 deletions .gitmodules
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
3 changes: 3 additions & 0 deletions .hound.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ LineLength:

StringLiterals:
Enabled: false

TrailingBlankLines:
Enabled: true
38 changes: 33 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,40 @@
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:
- 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
45 changes: 45 additions & 0 deletions CONTRIBUTING.md
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-mongodb.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-mongodb/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!
28 changes: 0 additions & 28 deletions Gemfile

This file was deleted.

63 changes: 53 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,59 @@
# Doorkeeper bundle
# doorkeeper-mongodb extension

====
## Installation

Doorkeeper's extracted ORM specifics.
doorkeeper-mongodb provides doorkeeper support to MongoMapper, Mongoid 2, 3 and 4.
To start using it, add to your Gemfile:

including:
``` ruby
gem 'doorkeeper-mongodb'
```

- 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.

To run locally, you need to choose a gemfile, with a command similar to:

```
$ export BUNDLE_GEMFILE=$PWD/gemfiles/Gemfile.mongoid4.rb
```

---

Please refer to https://github.com/doorkeeper-gem/doorkeeper for instructions on
doorkeeper’s project.
38 changes: 21 additions & 17 deletions Rakefile
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 -n 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
21 changes: 21 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
en:
orm: &orm
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.'

mongoid:
<<: *orm

mongo_mapper:
<<: *orm
1 change: 1 addition & 0 deletions doorkeeper
Submodule doorkeeper added at 7fe494
29 changes: 29 additions & 0 deletions doorkeeper-mongodb.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
$:.push File.expand_path("../lib", __FILE__)

# Maintain your gem's version:
require "doorkeeper-mongodb/version"

# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "doorkeeper-mongodb"
s.version = DoorkeeperMongodb::VERSION
s.authors = ["jasl"]
s.email = ["jasl9187@hotmail.com"]
s.homepage = "http://github.com/doorkeeper-gem/doorkeeper-mongodb"
s.summary = "Doorkeeper mongoid 2, 3, 4 and mongo_mapper ORMs"
s.description = "Doorkeeper mongoid 2, 3, 4 and mongo_mapper ORMs"
s.license = "MIT"

s.files = Dir["lib/**/*", "MIT-LICENSE", "Rakefile", "README.md"]
s.test_files = Dir["spec/**/*"]

s.add_dependency "doorkeeper", "~> 2.2.0"

s.add_development_dependency "sqlite3", "~> 1.3.5"
s.add_development_dependency "rspec-rails", "~> 3.2.0"
s.add_development_dependency "capybara", "~> 2.3.0"
s.add_development_dependency "generator_spec", "~> 0.9.0"
s.add_development_dependency "factory_girl", "~> 4.5.0"
s.add_development_dependency "timecop", "~> 0.7.0"
s.add_development_dependency "database_cleaner", "~> 1.3.0"
end
26 changes: 0 additions & 26 deletions doorkeeper-orms.gemspec

This file was deleted.

8 changes: 8 additions & 0 deletions gemfiles/Gemfile.common.rb
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: '../'
5 changes: 5 additions & 0 deletions gemfiles/Gemfile.mongo_mapper.rb
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'
5 changes: 5 additions & 0 deletions gemfiles/Gemfile.mongoid2.rb
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'
4 changes: 4 additions & 0 deletions gemfiles/Gemfile.mongoid3.rb
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'
4 changes: 4 additions & 0 deletions gemfiles/Gemfile.mongoid4.rb
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'
6 changes: 4 additions & 2 deletions lib/doorkeeper_bundle.rb → lib/doorkeeper-mongodb.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
require 'doorkeeper/orm/mongo_mapper'
require 'doorkeeper-mongodb/version'

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

module DoorkeeperOrms
module DoorkeeperMongodb
end
3 changes: 3 additions & 0 deletions lib/doorkeeper-mongodb/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module DoorkeeperMongodb
VERSION = "3.0.0"
end
3 changes: 0 additions & 3 deletions lib/doorkeeper-orms/version.rb

This file was deleted.

Loading