ae_declarative_authorization 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e24437f98ca9123a9e0c007325f8cfe0b88ed691b4cfcba2be9e9972d413b263
4
- data.tar.gz: 7c2b45c40951f5bc8ffc71f8c6b739727ee83aaaaea9f27f0d39f07640d3febb
3
+ metadata.gz: 751cbedf8879b1cc01f1353a5048e48253a2803b8d41a2acff126c0c39ddff42
4
+ data.tar.gz: a841b726d3501e12f7abed9143122ebf0325619498567ff044f996efc0a9f972
5
5
  SHA512:
6
- metadata.gz: 6e437f0d1a24441216a86efd1213973be469838819409445c5af8c892c80939a460c2d789493954ec5c5f74ae41c429e2dc66b39d02fbd505f28954c442ff1cb
7
- data.tar.gz: f25064eb69ea987a0387fc152dbf98cc1ac87e8b01de4fba54a87cfe2a5aa4acd5ecf525d39095a7a39f973c2e44ddc664b92ca90b814f3632b0fc79758cdd96
6
+ metadata.gz: d7572bb84e51d701713e1216d48b1d6d578cd99e5bad6e3f77e9e2f1158df46ac7d8b40c87ab034022c39e3301e6912d663a19b4cd4decb6f15208de6bb4210d
7
+ data.tar.gz: 955ca7bf9f17d9188ff372ae959ff7cbd95655025daf98cef65e31da1a965c654232f381ec584cccd28846c924f09d4bc84bd8619cf0a277555a3a5895e2b672
data/.circleci/config.yml CHANGED
@@ -8,12 +8,6 @@ commands:
8
8
  - run: bundle exec appraisal rake test
9
9
 
10
10
  jobs:
11
- test-ruby-233:
12
- docker:
13
- - image: circleci/ruby:2.3.3
14
- steps:
15
- - bundle_install_and_test
16
-
17
11
  test-ruby-253:
18
12
  docker:
19
13
  - image: circleci/ruby:2.5.3
@@ -29,8 +23,6 @@ jobs:
29
23
  workflows:
30
24
  rc:
31
25
  jobs:
32
- - test-ruby-233:
33
- context: appfolio_test_context
34
26
  - test-ruby-253:
35
27
  context: appfolio_test_context
36
28
  - test-ruby-263:
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-2.3.3
1
+ ruby-2.6.3
data/Appraisals CHANGED
@@ -1,40 +1,26 @@
1
- case RUBY_VERSION
2
-
3
- when '2.3.3', '2.5.3', '2.6.3' then
4
-
5
- appraise "ruby-#{RUBY_VERSION}-rails507" do
6
- gem 'rails', '5.0.7'
7
- gem 'grape', '1.1.0'
8
- gem 'rails-controller-testing'
9
- end
10
-
11
- appraise "ruby-#{RUBY_VERSION}-rails516" do
12
- gem 'rails', '5.1.6'
13
- gem 'grape', '1.2.3'
14
- gem 'rails-controller-testing'
15
- end
1
+ RAILS_VERSIONS = ['5.2.2.1', '6.0.2.1']
2
+ GRAPE_VERSIONS = ['1.1.0', '1.2.3', '1.3.0']
16
3
 
17
- appraise "ruby-#{RUBY_VERSION}-rails521" do
18
- gem 'rails', '5.2.1'
19
- gem 'grape', '1.2.3'
20
- gem 'rails-controller-testing'
21
- end
22
-
23
- appraise "ruby-#{RUBY_VERSION}-rails522" do
24
- gem 'rails', '5.2.2'
25
- gem 'grape', '1.2.3'
26
- gem 'rails-controller-testing'
27
- end
4
+ case RUBY_VERSION
28
5
 
29
- if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.5.0')
30
- appraise "ruby-#{RUBY_VERSION}-rails6" do
31
- gem 'rails', '~> 6.0'
32
- gem 'grape', '1.2.3'
33
- gem 'rails-controller-testing'
34
- gem 'sqlite3', '~> 1.4'
6
+ when '2.5.3', '2.6.3' then
7
+ RAILS_VERSIONS.product(GRAPE_VERSIONS).each do |rails_version, grape_version|
8
+ appraise "ruby-#{RUBY_VERSION}-rails#{rails_version}-grape#{grape_version}" do
9
+ gem 'rails', rails_version
10
+ gem 'grape', grape_version
11
+
12
+ if Gem::Version.new(grape_version) < Gem::Version.new('1.3.0')
13
+ # https://github.com/ruby-grape/grape/pull/1956
14
+ gem "rack", "< 2.1.0"
15
+ end
16
+
17
+ if Gem::Version.new(rails_version) >= Gem::Version.new('6')
18
+ gem 'sqlite3', '~> 1.4'
19
+ else
20
+ gem 'sqlite3', '~> 1.3.0'
21
+ end
35
22
  end
36
23
  end
37
-
38
24
  else
39
25
  raise "Unsupported Ruby version #{RUBY_VERSION}"
40
26
 
data/Gemfile CHANGED
@@ -5,4 +5,5 @@ gemspec
5
5
  gem 'appraisal', '~> 2.1'
6
6
  gem 'mocha', '~> 1.0', require: false
7
7
  gem 'sprockets', '< 4'
8
- gem 'sqlite3', '~> 1.3.0'
8
+
9
+ gem 'rails-controller-testing'
@@ -57,13 +57,18 @@ module Authorization
57
57
  ::Rails.logger
58
58
  end
59
59
 
60
- protected
61
-
62
60
  def api_class
63
61
  if options[:for].respond_to?(:base)
64
- options[:for].base # Grape >= 1.2.0 controller
62
+ # Grape >= 1.2.0 endpoint
63
+ # Authorization::Controller::Grape can be included into either Grape::API
64
+ # or Grape::API::Instance, so we need to check both.
65
+ [
66
+ options[:for],
67
+ options[:for].base
68
+ ].detect { |api| api.respond_to?(:decl_auth_context) }
65
69
  else
66
- options[:for] # Grape < 1.2.0 controller
70
+ # Grape < 1.2.0 endpoint
71
+ options[:for]
67
72
  end
68
73
  end
69
74
  end
@@ -68,11 +68,7 @@ module Authorization
68
68
 
69
69
  def controller_class(contr)
70
70
  if defined?(Grape) && contr.class < Grape::Endpoint
71
- if contr.options[:for].respond_to?(:base)
72
- contr.options[:for].base # Grape >= 1.2.0 controller
73
- else
74
- contr.options[:for] # Grape < 1.2.0 controller
75
- end
71
+ contr.api_class
76
72
  else
77
73
  contr.class # Rails controller
78
74
  end
@@ -1,3 +1,3 @@
1
1
  module DeclarativeAuthorization
2
- VERSION = '0.11.0'.freeze
2
+ VERSION = '0.12.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ae_declarative_authorization
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - AppFolio
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-01-06 00:00:00.000000000 Z
12
+ date: 2020-02-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: blockenspiel
@@ -103,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  - !ruby/object:Gem::Version
104
104
  version: '0'
105
105
  requirements: []
106
- rubygems_version: 3.0.3
106
+ rubygems_version: 3.0.6
107
107
  signing_key:
108
108
  specification_version: 4
109
109
  summary: ae_declarative_authorization is a Rails gem for maintainable authorization