Skip to content

Commit

Permalink
Update to upstream, specs, fixes
Browse files Browse the repository at this point in the history
* Update to Doorkeeper upstream
* Fix various issues
* Test against Rails 5.2
* Bump version
  • Loading branch information
nbulaj committed Feb 8, 2018
1 parent 336ed00 commit 7bdfc89
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ gemfile:
- gemfiles/rails-4.2.gemfile
- gemfiles/rails-5.0.gemfile
- gemfiles/rails-5.1.gemfile
- gemfiles/rails-5.2.gemfile

rvm:
- 2.1
Expand All @@ -26,3 +27,5 @@ matrix:
gemfile: gemfiles/rails-5.0.gemfile
- rvm: 2.1
gemfile: gemfiles/rails-5.1.gemfile
- rvm: 2.1
gemfile: gemfiles/rails-5.2.gemfile
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@ Reverse Chronological Order:

## master

https://github.com/nbulaj/doorkeeper-sequel/compare/1.3.0...master
https://github.com/nbulaj/doorkeeper-sequel/compare/1.3.2...master

...
## `1.4.0` (2018-02-08)

https://github.com/nbulaj/doorkeeper-sequel/compare/1.3.1...1.4.0

* Various fixes
* Update Doorkeeper to upstream

## `1.3.1` (2017-12-14)

Expand Down
3 changes: 2 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ class ExtensionIntegrator
FileUtils.cp_r('spec/stubs/config/initializers/db.rb', 'spec/dummy/config/initializers/db.rb')
FileUtils.cp_r('spec/stubs/config/application.rb', 'spec/dummy/config/application.rb')
FileUtils.cp_r('spec/stubs/support/sequel.rb', 'spec/support/orm/sequel.rb')
FileUtils.rm('spec/dummy/config/initializers/active_record_belongs_to_required_by_default.rb')
FileUtils.rm('spec/dummy/config/initializers/active_record_belongs_to_required_by_default.rb', force: true)
FileUtils.rm('spec/dummy/config/initializers/new_framework_defaults.rb', force: true)
# Remove generators specs because we are using our own
FileUtils.rm(Dir.glob('spec/generators/*.rb'))
end
Expand Down
3 changes: 2 additions & 1 deletion doorkeeper-sequel.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Gem::Specification.new do |gem|
gem.name = 'doorkeeper-sequel'
gem.version = DoorkeeperSequel.gem_version
gem.authors = ['Nikita Bulai']
gem.date = '2017-12-14'
gem.date = '2018-02-08'
gem.email = ['[email protected]']
gem.homepage = 'http://github.com/nbulaj/doorkeeper-sequel'
gem.summary = 'Doorkeeper Sequel ORM'
Expand All @@ -26,6 +26,7 @@ Gem::Specification.new do |gem|
gem.add_runtime_dependency 'sequel_polymorphic', '~> 0.2', '< 1.0'
gem.add_runtime_dependency 'thor', '>= 0.18', '< 6'

gem.add_development_dependency 'grape'
gem.add_development_dependency 'capybara', '~> 2.14', '>= 2.14.0'
gem.add_development_dependency 'database_cleaner', '~> 1.5', '>= 1.5.0'
gem.add_development_dependency 'factory_bot', '~> 4.8'
Expand Down
2 changes: 2 additions & 0 deletions gemfiles/rails-4.2.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ source 'https://rubygems.org'
gemspec path: '../'

gem 'rails', '~> 4.2', '<= 5.0'
# Older Grape requires Ruby >= 2.2.2
gem 'grape', '~> 0.16', '< 0.19.2'
gem 'sqlite3', '~> 1.3.5'
gem 'sequel', '>= 4.0'

Expand Down
11 changes: 11 additions & 0 deletions gemfiles/rails-5.2.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
source 'https://rubygems.org'

gemspec path: '..'

gem 'rails', '5.2.0.rc1'
gem 'sqlite3', '~> 1.3.5'
gem 'sequel', '>= 4.0'

group :test do
gem 'rspec-rails', '~> 3.6'
end
4 changes: 2 additions & 2 deletions lib/doorkeeper-sequel/gem_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ def self.gem_version

module VERSION
MAJOR = 1
MINOR = 3
TINY = 1
MINOR = 4
TINY = 0

STRING = [MAJOR, MINOR, TINY].compact.join('.')
end
Expand Down
4 changes: 2 additions & 2 deletions lib/doorkeeper/orm/sequel/models/access_token_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ def by_refresh_token(refresh_token)
first(refresh_token: refresh_token.to_s)
end

def revoke_all_for(application_id, resource_owner)
def revoke_all_for(application_id, resource_owner, clock = Time)
where(application_id: application_id,
resource_owner_id: resource_owner.id,
revoked_at: nil)
.each(&:revoke)
.update(revoked_at: clock.now.utc)
end

def matching_token_for(application, resource_owner_or_id, scopes)
Expand Down
2 changes: 2 additions & 0 deletions spec/stubs/models/user.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
class User < Sequel::Model
include Doorkeeper::Orm::Sequel::SequelCompat

class << self
def authenticate!(name, password)
User.where(name: name, password: password).first
Expand Down

0 comments on commit 7bdfc89

Please sign in to comment.