phi_attrs 0.3.0 → 0.3.1

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: be64c426b92892524e0263b2026ad0d654dc36f5dca2f75af0237df680638a76
4
- data.tar.gz: 314a8480ee93bd132bf0e9dbf0cd9dd5a6a8a7fa28f318d758645a074e07cf0e
3
+ metadata.gz: 6a9f9b3520ac31b3070fe055edc824ff9e5fb57ac7ae3a2aa1e21fbca0cbe938
4
+ data.tar.gz: c6e59941ca3647104021f42f15c983200f2abec40161873adeeef9188d8f28eb
5
5
  SHA512:
6
- metadata.gz: cb48b129482db7fab7c73b5b2de63d4f47e61ae551e230fc071de5d53c5079f681daea25d9db3ae2b7b483fee7986454734ef74e2783505a2e45c91b9c219a0e
7
- data.tar.gz: 7cfc622520e128ed1ee59045febadd5de155119e88dbb11560c3a52b1a71db85d40511352c9804bc7d542db7275e132cbb44cbe3b5e93ae607515271dc217361
6
+ metadata.gz: 11fc15e014f7a99b47d7bac128ac55497a1be75add80751168a60abe14234e86503c4cca8c88116e6cee66d10675394c2cd1e413e023826b0944778c2647bb68
7
+ data.tar.gz: 7bc73305c3a0713bcde53250b9334df225d885a31a15e3837b984b7783bd51974a37a97b92d706e74a93413eaf19b0972c1e998f12b6f1643c6159d46d396035
data/README.md CHANGED
@@ -438,9 +438,8 @@ Tests are written using [RSpec](http://rspec.info/) and are setup to use [Apprai
438
438
  $ bundle exec appraisal rspec spec/path/to/spec.rb
439
439
 
440
440
  To run just a particular rails version:
441
- $ bundle exec appraisal rails-5.1 rspec
442
- $ bundle exec appraisal rails-5.2 rspec
443
- $ bundle exec appraisal rails-6.0 rspec
441
+ $ bundle exec appraisal rails_6.1 rspec
442
+ $ bundle exec appraisal rails-7.0 rspec
444
443
 
445
444
  ### Console
446
445
 
@@ -624,6 +624,10 @@ module PhiAttrs
624
624
  # # through access logging.
625
625
  #
626
626
  def phi_wrap_method(method_name)
627
+ unless respond_to?(method_name)
628
+ PhiAttrs::Logger.warn("#{self.class.name} tried to wrap non-existant method (#{method_name})")
629
+ return
630
+ end
627
631
  return if self.class.__phi_methods_wrapped.include? method_name
628
632
 
629
633
  wrapped_method = :"__#{method_name}_phi_wrapped"
@@ -659,6 +663,7 @@ module PhiAttrs
659
663
  # @private
660
664
  #
661
665
  def phi_wrap_extension(method_name)
666
+ raise NameError, "Undefined relationship in `extend_phi_access`: #{method_name}" unless respond_to?(method_name)
662
667
  return if self.class.__phi_methods_to_extend.include? method_name
663
668
 
664
669
  wrapped_method = wrapped_extended_name(method_name)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PhiAttrs
4
- VERSION = '0.3.0'
4
+ VERSION = '0.3.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phi_attrs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wyatt Kirby
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-02-02 00:00:00.000000000 Z
11
+ date: 2023-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -185,30 +185,10 @@ executables: []
185
185
  extensions: []
186
186
  extra_rdoc_files: []
187
187
  files:
188
- - ".github/workflows/build.yml"
189
- - ".github/workflows/publish.yml"
190
- - ".gitignore"
191
- - ".rspec"
192
- - ".rubocop.yml"
193
- - Appraisals
194
188
  - CHANGELOG.md
195
189
  - DISCLAIMER.txt
196
- - Dockerfile
197
- - Gemfile
198
190
  - LICENSE.txt
199
191
  - README.md
200
- - Rakefile
201
- - bin/console
202
- - bin/helpers/docker
203
- - bin/rubo_fix
204
- - bin/run_tests
205
- - bin/setup
206
- - bin/ssh_to_container
207
- - config.ru
208
- - docker-compose.yml
209
- - docker/start.sh
210
- - gemfiles/rails_6.1.gemfile
211
- - gemfiles/rails_7.0.gemfile
212
192
  - lib/phi_attrs.rb
213
193
  - lib/phi_attrs/configure.rb
214
194
  - lib/phi_attrs/exceptions.rb
@@ -218,7 +198,6 @@ files:
218
198
  - lib/phi_attrs/railtie.rb
219
199
  - lib/phi_attrs/rspec.rb
220
200
  - lib/phi_attrs/version.rb
221
- - phi_attrs.gemspec
222
201
  homepage: http://www.apsis.io
223
202
  licenses:
224
203
  - MIT
@@ -242,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
242
221
  - !ruby/object:Gem::Version
243
222
  version: '0'
244
223
  requirements: []
245
- rubygems_version: 3.4.1
224
+ rubygems_version: 3.3.26
246
225
  signing_key:
247
226
  specification_version: 4
248
227
  summary: PHI Access Restriction & Logging for Rails ActiveRecord
@@ -1,27 +0,0 @@
1
- name: Spec CI
2
-
3
- on: [push, pull_request]
4
-
5
- jobs:
6
- build:
7
- runs-on: ubuntu-latest
8
- name: Ruby ${{ matrix.ruby }}
9
- strategy:
10
- matrix:
11
- # Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
12
- ruby: ['2.7.2', '3.0', 3.1]
13
- env:
14
- RUBY_VERSION: ${{ matrix.ruby }}
15
- steps:
16
- - uses: actions/checkout@v3
17
- - name: Set up Ruby ${{ matrix.ruby }}
18
- uses: ruby/setup-ruby@v1
19
- with:
20
- ruby-version: ${{ matrix.ruby }}
21
- bundler-cache: true
22
- - name: Install dependencies
23
- run: |
24
- bundle exec appraisal install
25
- - name: Run rspec
26
- run: |
27
- bundle exec appraisal "rake dummy:db:create dummy:db:migrate && rspec"
@@ -1,25 +0,0 @@
1
- name: Publish Gem
2
-
3
- on:
4
- push:
5
- branches:
6
- - "main"
7
- tags:
8
- - v*
9
- jobs:
10
- build:
11
- runs-on: ubuntu-latest
12
-
13
- steps:
14
- - uses: actions/checkout@v3
15
- - uses: ruby/setup-ruby@v1
16
- with:
17
- ruby-version: '3.1'
18
- bundler-cache: true
19
- - name: Release Gem
20
- if: contains(github.ref, 'refs/tags/v')
21
- uses: cadwallion/publish-rubygems-action@master
22
- env:
23
- GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
24
- RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}
25
- RELEASE_COMMAND: bundle exec rake release
data/.gitignore DELETED
@@ -1,23 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
-
11
- *Gemfile.lock
12
- .byebug_history
13
-
14
- /spec/dummy/tmp/
15
- /spec/dummy/db/schema.rb
16
- *.sqlite
17
- *.sqlite3
18
- *.log
19
- .rspec_status
20
- gemfiles/*.gemfile.lock
21
-
22
- # Macs. Ugh.
23
- .DS_Store
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
data/.rubocop.yml DELETED
@@ -1,94 +0,0 @@
1
- require: rubocop-rails
2
-
3
- Rails:
4
- Enabled: true
5
-
6
- AllCops:
7
- Exclude:
8
- - 'bin/**/*'
9
- - 'gemfiles/**/*'
10
- - 'spec/internal/db/schema.rb'
11
- NewCops: enable
12
- TargetRubyVersion: 2.7
13
-
14
- Layout/IndentationWidth:
15
- Enabled: true
16
-
17
- Layout/LineLength:
18
- Exclude:
19
- - 'spec/**/*'
20
- - 'lib/phi_attrs/phi_record.rb' # TODO: RUBOCOP Cleanup exclusion
21
- Max: 140
22
-
23
- Lint/UnreachableCode:
24
- Exclude:
25
- - 'lib/phi_attrs/phi_record.rb' # TODO: RUBOCOP Cleanup exclusion
26
-
27
- Lint/UnusedMethodArgument:
28
- Exclude:
29
- - 'lib/phi_attrs.rb' # TODO: RUBOCOP Cleanup exclusion
30
-
31
- Metrics/AbcSize:
32
- Max: 30
33
- Exclude:
34
- - 'spec/internal/db/**/*'
35
- - 'lib/phi_attrs/phi_record.rb' # TODO: RUBOCOP Cleanup exclusion
36
-
37
- Metrics/BlockLength:
38
- Enabled: false
39
-
40
- Metrics/ClassLength:
41
- Max: 1500
42
-
43
- Metrics/CyclomaticComplexity:
44
- Exclude:
45
- - 'lib/phi_attrs/phi_record.rb' # TODO: RUBOCOP Cleanup exclusion
46
-
47
- Metrics/MethodLength:
48
- Exclude:
49
- - 'spec/**/*'
50
- - 'lib/phi_attrs/phi_record.rb' # TODO: RUBOCOP Cleanup exclusion
51
- Max: 20
52
-
53
- Metrics/ModuleLength:
54
- Exclude:
55
- - 'lib/phi_attrs/phi_record.rb' # TODO: RUBOCOP Cleanup exclusion
56
-
57
- Metrics/PerceivedComplexity:
58
- Exclude:
59
- - 'lib/phi_attrs/phi_record.rb' # TODO: RUBOCOP Cleanup exclusion
60
-
61
- Naming/PredicateName:
62
- Enabled: false
63
-
64
- Rails/DynamicFindBy:
65
- Exclude:
66
- - 'spec/spec_helper.rb' # TODO: RUBOCOP Cleanup exclusion
67
-
68
- # Style/BracesAroundHashParameters:
69
- # Enabled: false
70
-
71
- Style/ClassVars:
72
- Enabled: false
73
-
74
- Style/CommentedKeyword:
75
- Exclude:
76
- - 'spec/**/*'
77
-
78
- Style/ConditionalAssignment:
79
- Enabled: false
80
-
81
- Style/Documentation:
82
- Enabled: false
83
-
84
- Style/EmptyMethod:
85
- EnforcedStyle: expanded
86
-
87
- Style/SymbolArray:
88
- EnforcedStyle: brackets
89
-
90
- Style/RedundantReturn:
91
- Enabled: false
92
-
93
- Style/WordArray:
94
- MinSize: 4
data/Appraisals DELETED
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- appraise 'rails_6.1' do
4
- gem 'rails', '~> 6.1'
5
- gem 'rspec', '~> 3.10'
6
- gem 'rspec-rails', '~> 5.1'
7
- gem 'sqlite3', '~> 1.5'
8
- end
9
-
10
- appraise 'rails_7.0' do
11
- gem 'rails', '~> 7.0'
12
- gem 'rspec', '~> 3.12'
13
- gem 'rspec-rails', '~> 6.0'
14
- gem 'sqlite3', '~> 1.5'
15
- end
data/Dockerfile DELETED
@@ -1,21 +0,0 @@
1
- ARG RUBY_VERSION=3.1.3
2
-
3
- FROM ruby:${RUBY_VERSION}-buster
4
-
5
- RUN apt-get update -qq && apt-get install -y --no-install-recommends \
6
- build-essential \
7
- git \
8
- bash \
9
- sqlite3
10
-
11
- ENV APP_HOME /app
12
- WORKDIR $APP_HOME
13
-
14
- COPY . $APP_HOME/
15
-
16
- RUN gem update --system
17
- RUN bundle config set force_ruby_platform true
18
-
19
- EXPOSE 3000
20
-
21
- CMD ["bash"]
data/Gemfile DELETED
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
-
7
- # Specify your gem's dependencies in phi_attrs.gemspec
8
- gemspec
data/Rakefile DELETED
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'rubygems'
4
- require 'bundler/setup'
5
- require 'bundler/gem_tasks'
6
-
7
- require 'rake'
8
-
9
- namespace :dummy do
10
- require_relative 'spec/dummy/application'
11
- Dummy::Application.load_tasks
12
- end
data/bin/console DELETED
@@ -1,20 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'bundler/setup'
4
- require 'phi_attrs'
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require 'irb'
14
- require 'irb/completion'
15
-
16
- PhiAttrs.configure do |conf|
17
- conf.log_path = File.join('log', 'phi_access_console.log')
18
- end
19
-
20
- IRB.start(__FILE__)
data/bin/helpers/docker DELETED
@@ -1,12 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- # runOnDocker SERVICE
4
- runOnDocker() {
5
- if [[ $DOCKER_CONTAINER -ne 1 ]]; then
6
- echo "On Host. Executing command on container"
7
- docker-compose exec -T $1 $0
8
- exit $?
9
- fi
10
- }
11
-
12
- export -f runOnDocker
data/bin/rubo_fix DELETED
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env bash
2
- source bin/helpers/docker
3
- runOnDocker ruby3
4
-
5
- echo "== Starting rubocop =="
6
- bundle exec rubocop --format worst --format simple --format offenses --auto-correct
data/bin/run_tests DELETED
@@ -1,19 +0,0 @@
1
- #!/usr/bin/env bash
2
- source bin/helpers/docker
3
- runOnDocker ruby3
4
-
5
- echo "== Starting unit tests =="
6
- bundle exec appraisal rspec
7
- if [ $? -ne 0 ]; then
8
- echo -e "\n== RSpec failed; push aborted! ==\n"
9
- exit 1
10
- fi
11
-
12
- echo "== Starting rubocop =="
13
- bundle exec rubocop --format worst --format simple --format offenses
14
- if [ $? -ne 0 ]; then
15
- echo -e "\n== Rubocop failed; push aborted! ==\n"
16
- echo -e "To auto-correct errors run:"
17
- echo -e "\tbin/rubo_fix"
18
- exit 1
19
- fi
data/bin/setup DELETED
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- gem install bundler -v $BUNDLER_VERSION
7
-
8
- bundle check || bundle install
9
- bundle exec appraisal install
data/bin/ssh_to_container DELETED
@@ -1,8 +0,0 @@
1
- #! /bin/bash
2
-
3
- CONTAINER=$1
4
- if [[ -z $CONTAINER ]]; then
5
- CONTAINER='ruby3'
6
- fi
7
-
8
- docker-compose run $CONTAINER sh
data/config.ru DELETED
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'rubygems'
4
- require 'bundler'
5
-
6
- Bundler.require :default, :development
data/docker/start.sh DELETED
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- echo "Beginning Setup"
4
- /app/bin/setup
5
-
6
- echo "Environment Ready"
7
- tail -f /etc/hosts
data/docker-compose.yml DELETED
@@ -1,37 +0,0 @@
1
- version: '3'
2
-
3
- services:
4
- ruby2:
5
- build:
6
- context: .
7
- args:
8
- - RUBY_VERSION=2.7.0
9
- volumes:
10
- - bundle_cache:/bundle
11
- - .:/app
12
- environment:
13
- - BUNDLER_VERSION=2.2.33
14
- - BUNDLE_JOBS=5
15
- - BUNDLE_PATH=/bundle
16
- - BUNDLE_BIN=/bundle/bin
17
- - GEM_HOME=/bundle
18
- - DOCKER_CONTAINER=1
19
- command:
20
- - docker/start.sh
21
- ruby3:
22
- build: .
23
- volumes:
24
- - bundle_cache:/bundle
25
- - .:/app
26
- environment:
27
- - BUNDLER_VERSION=2.4.0
28
- - BUNDLE_JOBS=5
29
- - BUNDLE_PATH=/bundle
30
- - BUNDLE_BIN=/bundle/bin
31
- - GEM_HOME=/bundle
32
- - DOCKER_CONTAINER=1
33
- command:
34
- - docker/start.sh
35
-
36
- volumes:
37
- bundle_cache:
@@ -1,10 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rails", "~> 6.1"
6
- gem "rspec", "~> 3.10"
7
- gem "rspec-rails", "~> 5.1"
8
- gem "sqlite3", "~> 1.5"
9
-
10
- gemspec path: "../"
@@ -1,10 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rails", "~> 7.0"
6
- gem "rspec", "~> 3.12"
7
- gem "rspec-rails", "~> 6.0"
8
- gem "sqlite3", "~> 1.5"
9
-
10
- gemspec path: "../"
data/phi_attrs.gemspec DELETED
@@ -1,47 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- lib = File.expand_path('lib', __dir__)
4
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require 'phi_attrs/version'
6
-
7
- Gem::Specification.new do |spec|
8
- spec.name = 'phi_attrs'
9
- spec.version = PhiAttrs::VERSION
10
- spec.authors = ['Wyatt Kirby']
11
- spec.email = ['wyatt@apsis.io']
12
-
13
- spec.summary = 'PHI Access Restriction & Logging for Rails ActiveRecord'
14
- spec.homepage = 'http://www.apsis.io'
15
- spec.license = 'MIT'
16
- spec.post_install_message = '
17
- Thank you for installing phi_attrs! By installing this gem,
18
- you acknowledge and agree to the disclaimer as provided in the
19
- DISCLAIMER.txt file.
20
-
21
- For full details, see: https://github.com/apsislabs/phi_attrs/blob/master/DISCLAIMER.txt
22
- '
23
-
24
- spec.required_ruby_version = '>= 2.7.0'
25
-
26
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
27
- f.match(%r{^(test|spec|features)/})
28
- end
29
- spec.bindir = 'exe'
30
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
- spec.require_paths = ['lib']
32
-
33
- spec.add_runtime_dependency 'rails', '>= 6.0.0'
34
- spec.add_runtime_dependency 'request_store', '~> 1.4'
35
-
36
- spec.add_development_dependency 'appraisal'
37
- spec.add_development_dependency 'bundler', '>= 2.2.33'
38
- spec.add_development_dependency 'byebug'
39
- spec.add_development_dependency 'factory_bot_rails'
40
- spec.add_development_dependency 'faker'
41
- spec.add_development_dependency 'rake'
42
- spec.add_development_dependency 'rubocop'
43
- spec.add_development_dependency 'rubocop-rails'
44
- spec.add_development_dependency 'simplecov', '~> 0.16'
45
- spec.add_development_dependency 'tzinfo-data'
46
- spec.metadata['rubygems_mfa_required'] = 'false'
47
- end