miau 1.0.2 → 1.1.1

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: 51787808adea91ad47f3319fa6e213bf6a648a028b58b037510aa4aa4c61a1d9
4
- data.tar.gz: abfba8aa4d1dd6525b6815cf3507f5d2ad6a2c1a100622c3ae9eff6f739e8c7f
3
+ metadata.gz: d207e809bfd3a605612092afc04287df2def3175e71a0a0b2c98c0ce491e1402
4
+ data.tar.gz: 4d5985b0b22a467848c0d5e1bc3fd14a22b3231b928e42fafa922f1faa5520fc
5
5
  SHA512:
6
- metadata.gz: 15281ba513735520710c4d29e8a6791ba429497a826cbb4c05e37e061335eea99ce88f27f53f468be4eb943357ec234e29317b6a889fd51357ed300ed8092641
7
- data.tar.gz: 58fe526fe70fb79ad6c97d216855541b2caa4a5e66307853441bf5c27cd96389d64d5d7d48959926a7d46c72b0f4778884d0a0146939c19a781b1863c71a58b8
6
+ metadata.gz: ba62cbe78a200045d483bb6b3c544fdbd57aa1a7b24a20ed73b8d5a3304d31420d088441edee0c2d16feaa4223c468375f1e985a78e38263c427e6e139173d6f
7
+ data.tar.gz: ff00545b68b70128919cc417ba69906e38eaf5decab73681bed88dc291fc648e8cdfa0c40e32942d08ed82605384ad5c76dd0723514f2a95cf6ec7e8deefdb62
@@ -8,19 +8,20 @@ jobs:
8
8
  strategy:
9
9
  fail-fast: false
10
10
  matrix:
11
- os: [ubuntu-latest]
12
- ruby: ["2.7", "3.0", "3.2", head]
13
- test_command: ["bundle exec rake test"]
14
- runs-on: ${{ matrix.os }}
11
+ ruby_version: ["3.0", "3.2", head]
12
+ gemfile:
13
+ - Gemfile
14
+ - gemfiles/Gemfile.rails-7.1
15
+ - gemfiles/Gemfile.rails-7.0
16
+ - gemfiles/Gemfile.rails-6.1
17
+ runs-on: ubuntu-latest
15
18
 
16
19
  steps:
17
- - uses: actions/checkout@v3
18
- - uses: ruby/setup-ruby@v1
19
- with:
20
- ruby-version: ${{ matrix.ruby }}
21
- - name: Bundle install
22
- run: |
23
- bundle config path /home/runner/bundle
24
- bundle install
25
- bundle update
26
- - run: ${{ matrix.test_command }}
20
+ - uses: actions/checkout@v3
21
+ - name: Set up Ruby
22
+ uses: ruby/setup-ruby@v1
23
+ with:
24
+ ruby-version: ${{ matrix.ruby_version }}
25
+ bundler-cache: true
26
+ - name: Build and test with Rake
27
+ run: bundle exec rake
data/.ruby-gemset CHANGED
@@ -1 +1 @@
1
- rails-7.0
1
+ rails-7.1
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-3.2.2
1
+ ruby-3.3.0
data/Appraisals ADDED
@@ -0,0 +1,13 @@
1
+ appraise "rails-7.1" do
2
+ gem "rails", "~> 7.1"
3
+ end
4
+
5
+ appraise "rails-7.0" do
6
+ gem "rails", "~> 7.0"
7
+ gem "dryer-config", "~> 7.0"
8
+ end
9
+
10
+ appraise "rails-6.1" do
11
+ gem "rails", "~> 6.1"
12
+ gem "dryer-config", "~> 6.0"
13
+ end
data/Gemfile.lock CHANGED
@@ -1,13 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- miau (1.0.2)
4
+ miau (1.1.1)
5
5
  activesupport
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activesupport (7.1.1)
10
+ activesupport (7.1.2)
11
11
  base64
12
12
  bigdecimal
13
13
  concurrent-ruby (~> 1.0, >= 1.0.2)
@@ -17,50 +17,53 @@ GEM
17
17
  minitest (>= 5.1)
18
18
  mutex_m
19
19
  tzinfo (~> 2.0)
20
+ appraisal (2.5.0)
21
+ bundler
22
+ rake
23
+ thor (>= 0.14.0)
20
24
  ast (2.4.2)
21
- base64 (0.1.1)
22
- benchmark-ips (2.12.0)
23
- bigdecimal (3.1.4)
25
+ base64 (0.2.0)
26
+ benchmark-ips (2.13.0)
27
+ bigdecimal (3.1.5)
24
28
  concurrent-ruby (1.2.2)
25
29
  connection_pool (2.4.1)
26
30
  docile (1.4.0)
27
- drb (2.1.1)
31
+ drb (2.2.0)
28
32
  ruby2_keywords
29
33
  i18n (1.14.1)
30
34
  concurrent-ruby (~> 1.0)
31
- json (2.6.3)
35
+ json (2.7.1)
32
36
  language_server-protocol (3.17.0.3)
33
37
  lint_roller (1.1.0)
34
38
  minitest (5.20.0)
35
- mutex_m (0.1.2)
39
+ mutex_m (0.2.0)
36
40
  observr (1.0.5)
37
- parallel (1.23.0)
38
- parser (3.2.2.4)
41
+ parallel (1.24.0)
42
+ parser (3.3.0.0)
39
43
  ast (~> 2.4.1)
40
44
  racc
41
45
  racc (1.7.3)
42
46
  rainbow (3.1.1)
43
47
  rake (13.1.0)
44
- regexp_parser (2.8.2)
48
+ regexp_parser (2.8.3)
45
49
  rexml (3.2.6)
46
50
  ricecream (0.2.1)
47
- rubocop (1.56.4)
48
- base64 (~> 0.1.1)
51
+ rubocop (1.59.0)
49
52
  json (~> 2.3)
50
53
  language_server-protocol (>= 3.17.0)
51
54
  parallel (~> 1.10)
52
- parser (>= 3.2.2.3)
55
+ parser (>= 3.2.2.4)
53
56
  rainbow (>= 2.2.2, < 4.0)
54
57
  regexp_parser (>= 1.8, < 3.0)
55
58
  rexml (>= 3.2.5, < 4.0)
56
- rubocop-ast (>= 1.28.1, < 2.0)
59
+ rubocop-ast (>= 1.30.0, < 2.0)
57
60
  ruby-progressbar (~> 1.7)
58
61
  unicode-display_width (>= 2.4.0, < 3.0)
59
62
  rubocop-ast (1.30.0)
60
63
  parser (>= 3.2.1.0)
61
- rubocop-performance (1.19.1)
62
- rubocop (>= 1.7.0, < 2.0)
63
- rubocop-ast (>= 0.4.0)
64
+ rubocop-performance (1.20.1)
65
+ rubocop (>= 1.48.1, < 2.0)
66
+ rubocop-ast (>= 1.30.0, < 2.0)
64
67
  ruby-progressbar (1.13.0)
65
68
  ruby2_keywords (0.0.5)
66
69
  simplecov (0.22.0)
@@ -69,33 +72,36 @@ GEM
69
72
  simplecov_json_formatter (~> 0.1)
70
73
  simplecov-html (0.12.3)
71
74
  simplecov_json_formatter (0.1.4)
72
- standard (1.31.2)
75
+ standard (1.33.0)
73
76
  language_server-protocol (~> 3.17.0.2)
74
77
  lint_roller (~> 1.0)
75
- rubocop (~> 1.56.4)
78
+ rubocop (~> 1.59.0)
76
79
  standard-custom (~> 1.0.0)
77
- standard-performance (~> 1.2)
80
+ standard-performance (~> 1.3)
78
81
  standard-custom (1.0.2)
79
82
  lint_roller (~> 1.0)
80
83
  rubocop (~> 1.50)
81
- standard-performance (1.2.1)
84
+ standard-performance (1.3.0)
82
85
  lint_roller (~> 1.1)
83
- rubocop-performance (~> 1.19.1)
86
+ rubocop-performance (~> 1.20.1)
87
+ thor (1.3.0)
84
88
  tzinfo (2.0.6)
85
89
  concurrent-ruby (~> 1.0)
86
90
  unicode-display_width (2.5.0)
87
91
 
88
92
  PLATFORMS
93
+ ruby
89
94
  x86_64-linux
90
95
 
91
96
  DEPENDENCIES
97
+ appraisal
92
98
  benchmark-ips
93
99
  miau!
100
+ minitest
94
101
  observr
95
- rake
96
102
  ricecream
97
103
  simplecov
98
104
  standard
99
105
 
100
106
  BUNDLED WITH
101
- 2.4.20
107
+ 2.5.3
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2021-2023 Dittmar Krall (www.matiq.com)
3
+ Copyright (c) 2021-2024 Dittmar Krall (www.matiq.com)
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
- Miau
2
- ====
1
+ # Miau
2
+
3
3
  [![Gem Version](https://badge.fury.io/rb/miau.png)](http://badge.fury.io/rb/miau)
4
+ [![GEM Downloads](https://img.shields.io/gem/dt/miau?color=168AFE&logo=ruby&logoColor=FE1616)](https://rubygems.org/gems/miau)
4
5
 
5
6
  Miau (MIcro AUthorization) is a simple authorization gem for Rails
6
7
  inspired by Pundit and Banken.
@@ -59,8 +60,7 @@ in case a policy returns "false" or isn't available.
59
60
 
60
61
  "app/policies/application_policy.rb" is included in the gem.
61
62
 
62
- Internals
63
- ---------
63
+ ## Internals
64
64
 
65
65
  At the bottom line based on a "policy" and an "action"
66
66
  a corresponding policy method is called.
@@ -92,8 +92,7 @@ A full blown sample :
92
92
  authorize! article, policy: :posts, action: :show
93
93
  ```
94
94
 
95
- Usage (more elaborated)
96
- -----------------------
95
+ ## Usage (more elaborated)
97
96
 
98
97
  ```ruby
99
98
  # app/models/application_controller.rb
@@ -126,8 +125,27 @@ Rescue's may be inserted previously in the exception chain.
126
125
 
127
126
  "verify_authorized" checks that an "authorize!" has been called.
128
127
 
129
- DRYing
130
- ------
128
+ ## Authorize Controller
129
+
130
+ Sometimes a whole controller can be authorized,
131
+ e.g. all actions requires admin priviledges.
132
+
133
+ The corresponding authorization is triggered by
134
+ a "before_action :authorize_controller!".
135
+ The corresponding policy is
136
+ defined by (e.g):
137
+
138
+ ```ruby
139
+ class PostsPolicy < ApplicationPolicy
140
+ ...
141
+ def controller
142
+ user.is_admin?
143
+ end
144
+ ...
145
+ end
146
+ ```
147
+
148
+ ## DRYing
131
149
 
132
150
  ```ruby
133
151
  # app/policies/posts_policy.rb --> # app/policies/posts_policy.rb
@@ -147,8 +165,8 @@ DRYing
147
165
  end
148
166
  ```
149
167
 
150
- PORO
151
- ----
168
+ ## PORO
169
+
152
170
  Miau is a small gem, it just provides a few helpers.
153
171
  All of the policy classes are just plain Ruby classes,
154
172
  allowing DRY, encapsulation, aliasing and inheritance.
@@ -158,7 +176,5 @@ Just the embedding in Rails required some specific knowledge.
158
176
 
159
177
  ## Miscellaneous
160
178
 
161
- Copyright (c) 2021-2023 Dittmar Krall (www.matiq.com),
162
- released under the MIT license:
163
-
164
- * https://opensource.org/licenses/MIT
179
+ Copyright (c) 2021-2024 Dittmar Krall (www.matiq.com),
180
+ released under the [MIT license](https://opensource.org/licenses/MIT).
@@ -0,0 +1,15 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "~> 6.1"
6
+ gem "dryer-config", "~> 6.0"
7
+
8
+ group :test do
9
+ gem "observr"
10
+ gem "standard", require: false
11
+ gem "simplecov", require: false
12
+ gem "benchmark-ips"
13
+ end
14
+
15
+ gemspec path: "../"
@@ -0,0 +1,223 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ miau (1.0.3)
5
+ activesupport
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actioncable (6.1.7.6)
11
+ actionpack (= 6.1.7.6)
12
+ activesupport (= 6.1.7.6)
13
+ nio4r (~> 2.0)
14
+ websocket-driver (>= 0.6.1)
15
+ actionmailbox (6.1.7.6)
16
+ actionpack (= 6.1.7.6)
17
+ activejob (= 6.1.7.6)
18
+ activerecord (= 6.1.7.6)
19
+ activestorage (= 6.1.7.6)
20
+ activesupport (= 6.1.7.6)
21
+ mail (>= 2.7.1)
22
+ actionmailer (6.1.7.6)
23
+ actionpack (= 6.1.7.6)
24
+ actionview (= 6.1.7.6)
25
+ activejob (= 6.1.7.6)
26
+ activesupport (= 6.1.7.6)
27
+ mail (~> 2.5, >= 2.5.4)
28
+ rails-dom-testing (~> 2.0)
29
+ actionpack (6.1.7.6)
30
+ actionview (= 6.1.7.6)
31
+ activesupport (= 6.1.7.6)
32
+ rack (~> 2.0, >= 2.0.9)
33
+ rack-test (>= 0.6.3)
34
+ rails-dom-testing (~> 2.0)
35
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
36
+ actiontext (6.1.7.6)
37
+ actionpack (= 6.1.7.6)
38
+ activerecord (= 6.1.7.6)
39
+ activestorage (= 6.1.7.6)
40
+ activesupport (= 6.1.7.6)
41
+ nokogiri (>= 1.8.5)
42
+ actionview (6.1.7.6)
43
+ activesupport (= 6.1.7.6)
44
+ builder (~> 3.1)
45
+ erubi (~> 1.4)
46
+ rails-dom-testing (~> 2.0)
47
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
48
+ activejob (6.1.7.6)
49
+ activesupport (= 6.1.7.6)
50
+ globalid (>= 0.3.6)
51
+ activemodel (6.1.7.6)
52
+ activesupport (= 6.1.7.6)
53
+ activerecord (6.1.7.6)
54
+ activemodel (= 6.1.7.6)
55
+ activesupport (= 6.1.7.6)
56
+ activestorage (6.1.7.6)
57
+ actionpack (= 6.1.7.6)
58
+ activejob (= 6.1.7.6)
59
+ activerecord (= 6.1.7.6)
60
+ activesupport (= 6.1.7.6)
61
+ marcel (~> 1.0)
62
+ mini_mime (>= 1.1.0)
63
+ activesupport (6.1.7.6)
64
+ concurrent-ruby (~> 1.0, >= 1.0.2)
65
+ i18n (>= 1.6, < 2)
66
+ minitest (>= 5.1)
67
+ tzinfo (~> 2.0)
68
+ zeitwerk (~> 2.3)
69
+ appraisal (2.5.0)
70
+ bundler
71
+ rake
72
+ thor (>= 0.14.0)
73
+ ast (2.4.2)
74
+ benchmark-ips (2.13.0)
75
+ builder (3.2.4)
76
+ concurrent-ruby (1.2.2)
77
+ crass (1.0.6)
78
+ date (3.3.4)
79
+ docile (1.4.0)
80
+ dryer-config (6.1.4)
81
+ erubi (1.12.0)
82
+ globalid (1.2.1)
83
+ activesupport (>= 6.1)
84
+ i18n (1.14.1)
85
+ concurrent-ruby (~> 1.0)
86
+ json (2.7.1)
87
+ language_server-protocol (3.17.0.3)
88
+ lint_roller (1.1.0)
89
+ loofah (2.22.0)
90
+ crass (~> 1.0.2)
91
+ nokogiri (>= 1.12.0)
92
+ mail (2.8.1)
93
+ mini_mime (>= 0.1.1)
94
+ net-imap
95
+ net-pop
96
+ net-smtp
97
+ marcel (1.0.2)
98
+ method_source (1.0.0)
99
+ mini_mime (1.1.5)
100
+ minitest (5.20.0)
101
+ net-imap (0.4.9.1)
102
+ date
103
+ net-protocol
104
+ net-pop (0.1.2)
105
+ net-protocol
106
+ net-protocol (0.2.2)
107
+ timeout
108
+ net-smtp (0.4.0.1)
109
+ net-protocol
110
+ nio4r (2.7.0)
111
+ nokogiri (1.16.0-x86_64-linux)
112
+ racc (~> 1.4)
113
+ observr (1.0.5)
114
+ parallel (1.24.0)
115
+ parser (3.3.0.0)
116
+ ast (~> 2.4.1)
117
+ racc
118
+ racc (1.7.3)
119
+ rack (2.2.8)
120
+ rack-test (2.1.0)
121
+ rack (>= 1.3)
122
+ rails (6.1.7.6)
123
+ actioncable (= 6.1.7.6)
124
+ actionmailbox (= 6.1.7.6)
125
+ actionmailer (= 6.1.7.6)
126
+ actionpack (= 6.1.7.6)
127
+ actiontext (= 6.1.7.6)
128
+ actionview (= 6.1.7.6)
129
+ activejob (= 6.1.7.6)
130
+ activemodel (= 6.1.7.6)
131
+ activerecord (= 6.1.7.6)
132
+ activestorage (= 6.1.7.6)
133
+ activesupport (= 6.1.7.6)
134
+ bundler (>= 1.15.0)
135
+ railties (= 6.1.7.6)
136
+ sprockets-rails (>= 2.0.0)
137
+ rails-dom-testing (2.2.0)
138
+ activesupport (>= 5.0.0)
139
+ minitest
140
+ nokogiri (>= 1.6)
141
+ rails-html-sanitizer (1.6.0)
142
+ loofah (~> 2.21)
143
+ nokogiri (~> 1.14)
144
+ railties (6.1.7.6)
145
+ actionpack (= 6.1.7.6)
146
+ activesupport (= 6.1.7.6)
147
+ method_source
148
+ rake (>= 12.2)
149
+ thor (~> 1.0)
150
+ rainbow (3.1.1)
151
+ rake (13.1.0)
152
+ regexp_parser (2.8.3)
153
+ rexml (3.2.6)
154
+ ricecream (0.2.1)
155
+ rubocop (1.59.0)
156
+ json (~> 2.3)
157
+ language_server-protocol (>= 3.17.0)
158
+ parallel (~> 1.10)
159
+ parser (>= 3.2.2.4)
160
+ rainbow (>= 2.2.2, < 4.0)
161
+ regexp_parser (>= 1.8, < 3.0)
162
+ rexml (>= 3.2.5, < 4.0)
163
+ rubocop-ast (>= 1.30.0, < 2.0)
164
+ ruby-progressbar (~> 1.7)
165
+ unicode-display_width (>= 2.4.0, < 3.0)
166
+ rubocop-ast (1.30.0)
167
+ parser (>= 3.2.1.0)
168
+ rubocop-performance (1.20.1)
169
+ rubocop (>= 1.48.1, < 2.0)
170
+ rubocop-ast (>= 1.30.0, < 2.0)
171
+ ruby-progressbar (1.13.0)
172
+ simplecov (0.22.0)
173
+ docile (~> 1.1)
174
+ simplecov-html (~> 0.11)
175
+ simplecov_json_formatter (~> 0.1)
176
+ simplecov-html (0.12.3)
177
+ simplecov_json_formatter (0.1.4)
178
+ sprockets (4.2.1)
179
+ concurrent-ruby (~> 1.0)
180
+ rack (>= 2.2.4, < 4)
181
+ sprockets-rails (3.4.2)
182
+ actionpack (>= 5.2)
183
+ activesupport (>= 5.2)
184
+ sprockets (>= 3.0.0)
185
+ standard (1.33.0)
186
+ language_server-protocol (~> 3.17.0.2)
187
+ lint_roller (~> 1.0)
188
+ rubocop (~> 1.59.0)
189
+ standard-custom (~> 1.0.0)
190
+ standard-performance (~> 1.3)
191
+ standard-custom (1.0.2)
192
+ lint_roller (~> 1.0)
193
+ rubocop (~> 1.50)
194
+ standard-performance (1.3.0)
195
+ lint_roller (~> 1.1)
196
+ rubocop-performance (~> 1.20.1)
197
+ thor (1.3.0)
198
+ timeout (0.4.1)
199
+ tzinfo (2.0.6)
200
+ concurrent-ruby (~> 1.0)
201
+ unicode-display_width (2.5.0)
202
+ websocket-driver (0.7.6)
203
+ websocket-extensions (>= 0.1.0)
204
+ websocket-extensions (0.1.5)
205
+ zeitwerk (2.6.12)
206
+
207
+ PLATFORMS
208
+ x86_64-linux
209
+
210
+ DEPENDENCIES
211
+ appraisal
212
+ benchmark-ips
213
+ dryer-config (~> 6.0)
214
+ miau!
215
+ minitest
216
+ observr
217
+ rails (~> 6.1)
218
+ ricecream
219
+ simplecov
220
+ standard
221
+
222
+ BUNDLED WITH
223
+ 2.5.3
@@ -0,0 +1,15 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "~> 7.0"
6
+ gem "dryer-config", "~> 7.0"
7
+
8
+ group :test do
9
+ gem "observr"
10
+ gem "standard", require: false
11
+ gem "simplecov", require: false
12
+ gem "benchmark-ips"
13
+ end
14
+
15
+ gemspec path: "../"