snfoil-policy 0.0.1 → 0.0.4

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
2
  SHA256:
3
- metadata.gz: 111becd9c6e60e5d7deda40f9f0f3325d06e30652a68558ebeb2282b6bd35986
4
- data.tar.gz: f3b278ef4ac6665e59a6707c0e17dd60bd56d1eb5262599649fb26d0cf5ef20a
3
+ metadata.gz: 10387a21899e943f8e08f40a5cfd07160ee1ff34029d218f203cea592411f59d
4
+ data.tar.gz: 5716220afb211ddd5429dce8e441c7f4da0962c8d5c151a7e91efa092a73e37c
5
5
  SHA512:
6
- metadata.gz: 404e9808b598cbf50be0f931e7e48691015e5a6ff7ded650ccd11030d2150e2e2eb9f4ea8a12162807369b237826cfdd63c186bcff141e8e1e6eeb31b16b4ea0
7
- data.tar.gz: 3898c4814640ae1a18bc1561f8773dc428fe937f608f5323c5e6629bc09056ecb287a270618937e2213f084319e2294fba093a8a7609919293e277e377eeae10
6
+ metadata.gz: e7a1f2851a9af5596ab05a16b33f133d2b185b4618778e87a4d699c75f58574faf2e375123d5926862b39f3ceca2c20b88d77e4e59340755ae7cdd49a455dc05
7
+ data.tar.gz: ae93318be284877dd34407bd31c42b3914ee89288e81033db92e75945861492455b867daabd05cbc4a92953d7a24d5c6d8594d950a27cf570b0926a91ea53689
data/.fasterer.yml ADDED
@@ -0,0 +1,22 @@
1
+ speedups:
2
+ rescue_vs_respond_to: true
3
+ module_eval: true
4
+ shuffle_first_vs_sample: true
5
+ for_loop_vs_each: true
6
+ each_with_index_vs_while: false
7
+ map_flatten_vs_flat_map: true
8
+ reverse_each_vs_reverse_each: true
9
+ select_first_vs_detect: true
10
+ sort_vs_sort_by: true
11
+ fetch_with_argument_vs_block: true
12
+ keys_each_vs_each_key: true
13
+ hash_merge_bang_vs_hash_brackets: true
14
+ block_vs_symbol_to_proc: true
15
+ proc_call_vs_yield: true
16
+ gsub_vs_tr: true
17
+ select_last_vs_reverse_detect: true
18
+ getter_vs_attr_reader: true
19
+ setter_vs_attr_writer: true
20
+
21
+ exclude_paths:
22
+ - 'vendor/**/*.rb'
@@ -1,5 +1,5 @@
1
1
  name: build
2
- on:
2
+ on:
3
3
  push:
4
4
  branches: [ main ]
5
5
  pull_request:
@@ -11,7 +11,7 @@ jobs:
11
11
 
12
12
  strategy:
13
13
  matrix:
14
- ruby-version: [2.7, 2.6, 2.5]
14
+ ruby-version: [2.7, 2.6, 2.5, '3.0']
15
15
 
16
16
  steps:
17
17
  - uses: actions/checkout@v2
@@ -43,4 +43,8 @@ jobs:
43
43
  run: bundle install
44
44
  - name: Run rubocop
45
45
  run: bundle exec rubocop
46
+ - name: Run fasterer
47
+ run: bundle exec fasterer
48
+ - name: Run bundle audit
49
+ run: bundle exec bundle audit check --update
46
50
 
data/.rubocop.yml CHANGED
@@ -24,6 +24,7 @@ Lint/EmptyClass:
24
24
  Metrics/BlockLength:
25
25
  Exclude:
26
26
  - spec/**/*_spec.rb
27
+ - snfoil-policy.gemspec
27
28
 
28
29
  # ================ RSPEC ================
29
30
  RSpec/FilePath:
data/README.md CHANGED
@@ -2,8 +2,7 @@
2
2
 
3
3
  ![build](https://github.com/limited-effort/snfoil-policy/actions/workflows/main.yml/badge.svg) [![maintainability](https://api.codeclimate.com/v1/badges/81c3abdb068a2305d4ce/maintainability)](https://codeclimate.com/github/limited-effort/snfoil-policy/maintainability)
4
4
 
5
- SnFoil Policies are an easy and intuitive way to built [Pundit](https://github.com/varvet/pundit) style authorization files with a little extra base functionality added in.
6
-
5
+ SnFoil Policies are an easy and intuitive way to build [Pundit](https://github.com/varvet/pundit) style authorization files with a little extra base functionality added in.
7
6
 
8
7
  While it isn't required you use [Pundit](https://github.com/varvet/pundit) with it, we highly recommend it.
9
8
 
@@ -21,7 +20,7 @@ gem 'snfoil-policy'
21
20
 
22
21
  SnFoil Policies are meant to be used just like Pundit policies except you can build the actions using a helper and some of the setup work has been done for you.
23
22
 
24
- The entity being authorizated (usually a User) is accessible via the `entity` instance variable.
23
+ The entity being authorized (usually a User) is accessible via the `entity` instance variable.
25
24
  And the record the entity is trying to work with is accessible as the `record` instance variable.
26
25
 
27
26
  Use `permission` to start setting up some checks.
@@ -88,7 +87,7 @@ end
88
87
  permission :update?, with: :create?
89
88
  ```
90
89
 
91
- For more complex authorization mechanisms where more than one type of entity can operate against a record you can supply the type of the entity to check against.
90
+ For more complex authorization mechanisms where more than one type of entity can operate against a record, you can supply the type of entity to check against.
92
91
 
93
92
  ```ruby
94
93
  permission :create?, User do
@@ -115,7 +114,7 @@ end
115
114
 
116
115
  ### Scope
117
116
 
118
- There is nothing special about SnFoil Policy Scopes. They are just defined to make life a little easier. Go ahead an check out how to use Scopes in [Pundit](https://github.com/varvet/pundit#scopes), we highly recommend them.
117
+ There is nothing special about SnFoil Policy Scopes. They are just defined to make life a little easier. Check out how to use Scopes in [Pundit](https://github.com/varvet/pundit#scopes), we highly recommend them.
119
118
 
120
119
 
121
120
  ## Development
@@ -134,4 +133,4 @@ The gem is available as open source under the terms of the [Apache 2 License](ht
134
133
 
135
134
  ## Code of Conduct
136
135
 
137
- Everyone interacting in the Snfoil::Policy project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/limited-effort/snfoil-policy/blob/main/CODE_OF_CONDUCT.md).
136
+ Everyone interacting in the Snfoil::Policy project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the [code of conduct](https://github.com/limited-effort/snfoil-policy/blob/main/CODE_OF_CONDUCT.md).
@@ -2,6 +2,6 @@
2
2
 
3
3
  module SnFoil
4
4
  module Policy
5
- VERSION = '0.0.1'
5
+ VERSION = '0.0.4'
6
6
  end
7
7
  end
data/lib/snfoil/policy.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2021 Matthew Howes
3
+ # Copyright 2021 Matthew Howes, Cliff Campbell
4
4
 
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
@@ -5,13 +5,13 @@ require_relative 'lib/snfoil/policy/version'
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'snfoil-policy'
7
7
  spec.version = SnFoil::Policy::VERSION
8
- spec.authors = ['Matthew Howes']
9
- spec.email = ['howeszy@gmail.com']
8
+ spec.authors = ['Matthew Howes', 'Cliff Campbell']
9
+ spec.email = ['howeszy@gmail.com', 'cliffcampbell@hey.com']
10
10
 
11
11
  spec.summary = 'Pundit Style Permissions Builder'
12
12
  spec.description = 'A set of helper functions to build permission files inspired by Pundit.'
13
13
  spec.homepage = 'https://github.com/limited-effort/snfoil-policy'
14
- spec.license = 'MIT'
14
+ spec.license = 'Apache-2.0'
15
15
  spec.required_ruby_version = '>= 2.5.0'
16
16
 
17
17
  spec.metadata['homepage_uri'] = spec.homepage
@@ -30,6 +30,8 @@ Gem::Specification.new do |spec|
30
30
 
31
31
  spec.add_dependency 'activesupport', '>= 5.2.6'
32
32
 
33
+ spec.add_development_dependency 'bundle-audit', '~> 0.1.0'
34
+ spec.add_development_dependency 'fasterer', '~> 0.9.0'
33
35
  spec.add_development_dependency 'pry-byebug', '~> 3.9'
34
36
  spec.add_development_dependency 'rake', '~> 13.0'
35
37
  spec.add_development_dependency 'rspec', '~> 3.10'
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snfoil-policy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Howes
8
+ - Cliff Campbell
8
9
  autorequire:
9
10
  bindir: exe
10
11
  cert_chain: []
11
- date: 2021-10-12 00:00:00.000000000 Z
12
+ date: 2021-10-28 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: activesupport
@@ -24,6 +25,34 @@ dependencies:
24
25
  - - ">="
25
26
  - !ruby/object:Gem::Version
26
27
  version: 5.2.6
28
+ - !ruby/object:Gem::Dependency
29
+ name: bundle-audit
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: 0.1.0
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: 0.1.0
42
+ - !ruby/object:Gem::Dependency
43
+ name: fasterer
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: 0.9.0
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: 0.9.0
27
56
  - !ruby/object:Gem::Dependency
28
57
  name: pry-byebug
29
58
  requirement: !ruby/object:Gem::Requirement
@@ -111,10 +140,12 @@ dependencies:
111
140
  description: A set of helper functions to build permission files inspired by Pundit.
112
141
  email:
113
142
  - howeszy@gmail.com
143
+ - cliffcampbell@hey.com
114
144
  executables: []
115
145
  extensions: []
116
146
  extra_rdoc_files: []
117
147
  files:
148
+ - ".fasterer.yml"
118
149
  - ".github/workflows/main.yml"
119
150
  - ".gitignore"
120
151
  - ".rspec"
@@ -132,7 +163,7 @@ files:
132
163
  - snfoil-policy.gemspec
133
164
  homepage: https://github.com/limited-effort/snfoil-policy
134
165
  licenses:
135
- - MIT
166
+ - Apache-2.0
136
167
  metadata:
137
168
  homepage_uri: https://github.com/limited-effort/snfoil-policy
138
169
  source_code_uri: https://github.com/limited-effort/snfoil-policy