pundit 1.1.0 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: a2c188098c86ad5a0804044f80219014564501ef
4
- data.tar.gz: 2ab7f79275d9ae66e5d04cf980c11e2c2983a4ef
2
+ SHA256:
3
+ metadata.gz: 74f2f6efff0c12342afad4bb45dc75f12443e20f6ab5a9ed40274f2f842f2441
4
+ data.tar.gz: ad984e338045f040964301fdf2c79323d2e1a1ebffad16fc332d49315de14da2
5
5
  SHA512:
6
- metadata.gz: 55fbbf71ad514c0cfe4f8933dea59915314f749efa53ab5579f2da9dfcf2b4786343cefa53d3a35e26f4a346776c1c513884595a39561d280b259e6b6fb9b31a
7
- data.tar.gz: bbcf9417801b22deac78afe2d5ea8a268193daf0e011f861006c25b1d0124d1f462aa37d4d38e623b9d438cb29ceb52b250575118e053862b74561795bbdd7a4
6
+ metadata.gz: 106c8df42fc14b485dc4ea3951fba00232b6fa739b0a5910d9c33a33dde04cb1c015ecbf77f07a38274b9f9ae43ea5cfbbafb283f5eddc42fbf9454820ab87af
7
+ data.tar.gz: 4ab2a989938496acf224a9b20c247010e8d5882de168a995a02dbde021d308d7602f6305d675b26d461dcfb171346b02a1979325471f8713644aab8aac2dab9a
data/.gitignore CHANGED
@@ -2,6 +2,7 @@
2
2
  *.rbc
3
3
  .bundle
4
4
  .config
5
+ .coverage
5
6
  .yardoc
6
7
  Gemfile.lock
7
8
  InstalledFiles
data/.rubocop.yml CHANGED
@@ -1,16 +1,23 @@
1
1
  AllCops:
2
+ TargetRubyVersion: 2.6
2
3
  Exclude:
3
- - "gemfiles/**/*"
4
- - "vendor/**/*"
5
- - "lib/generators/**/*"
4
+ - "lib/generators/**/templates/**/*"
5
+ SuggestExtensions: false
6
+ NewCops: disable
7
+
8
+ Metrics/BlockLength:
9
+ Exclude:
10
+ - "**/*_spec.rb"
6
11
 
7
12
  Metrics/MethodLength:
8
13
  Max: 40
9
14
 
10
15
  Metrics/ModuleLength:
11
16
  Max: 200
17
+ Exclude:
18
+ - "**/*_spec.rb"
12
19
 
13
- Metrics/LineLength:
20
+ Layout/LineLength:
14
21
  Max: 120
15
22
 
16
23
  Metrics/AbcSize:
@@ -22,74 +29,44 @@ Metrics/CyclomaticComplexity:
22
29
  Metrics/PerceivedComplexity:
23
30
  Enabled: false
24
31
 
25
- Style/StructInheritance:
26
- Enabled: false
32
+ Gemspec/RequiredRubyVersion:
33
+ Enabled: false
27
34
 
28
- Style/AlignParameters:
35
+ Layout/ParameterAlignment:
29
36
  EnforcedStyle: with_fixed_indentation
30
37
 
31
- Style/StringLiterals:
32
- EnforcedStyle: double_quotes
33
-
34
- Style/StringLiteralsInInterpolation:
35
- EnforcedStyle: double_quotes
36
-
37
- Style/ClosingParenthesisIndentation:
38
- Enabled: false
39
-
40
- Style/OneLineConditional:
41
- Enabled: false
42
-
43
- Style/AndOr:
44
- Enabled: false
45
-
46
- Style/Not:
47
- Enabled: false
48
-
49
- Documentation:
50
- Enabled: false # TODO: Enable again once we have more docs
51
-
52
- Style/CaseIndentation:
53
- IndentWhenRelativeTo: case
38
+ Layout/CaseIndentation:
39
+ EnforcedStyle: case
54
40
  SupportedStyles:
55
41
  - case
56
42
  - end
57
43
  IndentOneStep: true
58
44
 
45
+ Layout/EndAlignment:
46
+ EnforcedStyleAlignWith: variable
47
+
59
48
  Style/PercentLiteralDelimiters:
60
49
  PreferredDelimiters:
61
50
  '%w': "[]"
62
51
  '%W': "[]"
63
52
 
64
- Style/AccessModifierIndentation:
65
- EnforcedStyle: outdent
66
-
67
- Style/SignalException:
68
- Enabled: false
69
-
70
- Style/IndentationWidth:
71
- Enabled: false
72
-
73
- Style/TrivialAccessors:
74
- ExactNameMatch: true
75
-
76
- Lint/EndAlignment:
77
- AlignWith: variable
78
-
79
- Lint/DefEndAlignment:
80
- Enabled: false
53
+ Style/StringLiterals:
54
+ EnforcedStyle: double_quotes
81
55
 
82
- Lint/HandleExceptions:
83
- Enabled: false
56
+ Style/StringLiteralsInInterpolation:
57
+ EnforcedStyle: double_quotes
84
58
 
85
- Style/SpecialGlobalVars:
59
+ Style/StructInheritance:
86
60
  Enabled: false
87
61
 
88
- Style/TrivialAccessors:
62
+ Style/AndOr:
89
63
  Enabled: false
90
64
 
91
- Style/IndentHash:
65
+ Style/Not:
92
66
  Enabled: false
93
67
 
94
68
  Style/DoubleNegation:
95
69
  Enabled: false
70
+
71
+ Style/Documentation:
72
+ Enabled: false # TODO: Enable again once we have more docs
data/.travis.yml CHANGED
@@ -1,11 +1,26 @@
1
1
  language: ruby
2
- sudo: false
3
- rvm:
4
- - 2.0.0
5
- - 2.1
6
- - 2.2
7
- - jruby-19mode
8
- - rbx-2
9
- env:
10
- - RSPEC_VERSION="<2.99"
11
- - RSPEC_VERSION="~>3.0
2
+ dist: focal
3
+
4
+ matrix:
5
+ include:
6
+ - name: "RuboCop lint on pre-installed Ruby version"
7
+ rvm: 2.7.1 # Pre-installed Ruby version
8
+ before_install:
9
+ - gem install bundler
10
+ script: bundle exec rake rubocop # ONLY lint once, first
11
+ - rvm: 2.6.7
12
+ before_script:
13
+ - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
14
+ - chmod +x ./cc-test-reporter
15
+ - ./cc-test-reporter before-build
16
+ after_script:
17
+ - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
18
+ - rvm: 2.7.3
19
+ - rvm: 3.0.1
20
+ - rvm: 3.1.0
21
+ - rvm: jruby-9.2.17.0
22
+ env:
23
+ - JRUBY_OPTS="--debug"
24
+ - rvm: truffleruby-head
25
+ allow_failures:
26
+ - rvm: truffleruby-head
data/CHANGELOG.md CHANGED
@@ -1,5 +1,93 @@
1
1
  # Pundit
2
2
 
3
+ ## 2.3.0 (2022-12-19)
4
+
5
+ ### Added
6
+
7
+ - add support for rubocop-rspec syntax extensions (#745)
8
+
9
+ ## 2.2.0 (2022-02-11)
10
+
11
+ ### Fixed
12
+
13
+ - Using `policy_class` and a namespaced record now passes only the record when instantiating the policy. (#697, #689, #694, #666)
14
+
15
+ ### Changed
16
+
17
+ - Require users to explicitly define Scope#resolve in generated policies (#711, #722)
18
+
19
+ ### Deprecated
20
+
21
+ - Deprecate `include Pundit` in favor of `include Pundit::Authorization` (#621)
22
+
23
+ ## 2.1.1 (2021-08-13)
24
+
25
+ Friday 13th-release!
26
+
27
+ Careful! The bugfix below (#626) could break existing code. If you rely on the
28
+ return value for `authorize` and namespaced policies you might need to do some
29
+ changes.
30
+
31
+ ### Fixed
32
+
33
+ - `.authorize` and `#authorize` return the instance, even for namespaced
34
+ policies (#626)
35
+
36
+ ### Changed
37
+
38
+ - Generate application scope with `protected` attr_readers. (#616)
39
+
40
+ ### Removed
41
+
42
+ - Dropped support for Ruby end-of-life versions: 2.1 and 2.2. (#604)
43
+ - Dropped support for Ruby end-of-life versions: 2.3 (#633)
44
+ - Dropped support for Ruby end-of-life versions: 2.4, 2.5 and JRuby 9.1 (#676)
45
+ - Dropped support for RSpec 2 (#615)
46
+
47
+ ## 2.1.0 (2019-08-14)
48
+
49
+ ### Fixed
50
+
51
+ - Avoid name clashes with the Error class. (#590)
52
+
53
+ ### Changed
54
+
55
+ - Return a safer default NotAuthorizedError message. (#583)
56
+
57
+ ## 2.0.1 (2019-01-18)
58
+
59
+ ### Breaking changes
60
+
61
+ None
62
+
63
+ ### Other changes
64
+
65
+ - Improve exception handling for `#policy_scope` and `#policy_scope!`. (#550)
66
+ - Add `:policy` metadata to RSpec template. (#566)
67
+
68
+ ## 2.0.0 (2018-07-21)
69
+
70
+ No changes since beta1
71
+
72
+ ## 2.0.0.beta1 (2018-07-04)
73
+
74
+ ### Breaking changes
75
+
76
+ - Only pass last element of "namespace array" to policy and scope. (#529)
77
+ - Raise `InvalidConstructorError` if a policy or policy scope with an invalid constructor is called. (#462)
78
+ - Return passed object from `#authorize` method to make chaining possible. (#385)
79
+
80
+ ### Other changes
81
+
82
+ - Add `policy_class` option to `authorize` to be able to override the policy. (#441)
83
+ - Add `policy_scope_class` option to `authorize` to be able to override the policy scope. (#441)
84
+ - Fix `param_key` issue when passed an array. (#529)
85
+ - Allow specification of a `NilClassPolicy`. (#525)
86
+ - Make sure `policy_class` override is called when passed an array. (#475)
87
+
88
+ - Use `action_name` instead of `params[:action]`. (#419)
89
+ - Add `pundit_params_for` method to make it easy to customize params fetching. (#502)
90
+
3
91
  ## 1.1.0 (2016-01-14)
4
92
 
5
93
  - Can retrieve policies via an array of symbols/objects.
data/Gemfile CHANGED
@@ -1,4 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source "https://rubygems.org"
2
4
 
3
- gem "rspec", ENV["RSPEC_VERSION"] unless ENV["RSPEC_VERSION"].to_s.empty?
5
+ ruby RUBY_VERSION
6
+
4
7
  gemspec
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012 Jonas Nicklas, Elabs AB
1
+ Copyright (c) 2019 Jonas Nicklas, Varvet AB
2
2
 
3
3
  MIT License
4
4