phi_attrs 0.2.4 → 0.3.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: 1cc2ab95144c51b9ce2322864983ff9302d65d3e585c8ced98f1fe3098761173
4
- data.tar.gz: 377a9e45f0069b4817a9156a66969b3056553707ae0f6a61716c16cbdc978a8a
3
+ metadata.gz: 6a9f9b3520ac31b3070fe055edc824ff9e5fb57ac7ae3a2aa1e21fbca0cbe938
4
+ data.tar.gz: c6e59941ca3647104021f42f15c983200f2abec40161873adeeef9188d8f28eb
5
5
  SHA512:
6
- metadata.gz: 78aa212eceac4e6b0ef10289ac0517b3d9943add98550fcffbc374e9d3d773ab3395d0cfae792161b6793f05fd7a08347e60b76201a6c719954956c902396fb2
7
- data.tar.gz: 8fed8925c193caf3c169dff50800766d0abd9b45e6dd652de31b93b8219a2c3d425ac111a9c4b8608fbbfbc23a2e038f13bda2d89004a65fa801eb15dfcdbb37
6
+ metadata.gz: 11fc15e014f7a99b47d7bac128ac55497a1be75add80751168a60abe14234e86503c4cca8c88116e6cee66d10675394c2cd1e413e023826b0944778c2647bb68
7
+ data.tar.gz: 7bc73305c3a0713bcde53250b9334df225d885a31a15e3837b984b7783bd51974a37a97b92d706e74a93413eaf19b0972c1e998f12b6f1643c6159d46d396035
data/README.md CHANGED
@@ -321,7 +321,7 @@ module Admin
321
321
 
322
322
  def leviosa
323
323
  patient_info.allow_phi(current_user) do
324
- # reason tries to use `phi.admin.patient_dashbaord.expelliarmus.patient_info`
324
+ # reason tries to use `phi.admin.patient_dashbaord.leviosa.patient_info`
325
325
  end
326
326
  end
327
327
  end
@@ -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
 
@@ -484,4 +483,4 @@ Apsis Labs, LLP is not a HIPAA covered entity, and usage of this software does n
484
483
 
485
484
  [![apsis](https://s3-us-west-2.amazonaws.com/apsiscdn/apsis.png)](https://www.apsis.io)
486
485
 
487
- `phi_attrs` was built by Apsis Labs. We love sharing what we build! Check out our [other libraries on Github](https://github.com/apsislabs), and if you like our work you can [hire us](https://www.apsis.io/work-with-us/) to build your vision.
486
+ `phi_attrs` was built by Apsis Labs. We love sharing what we build! Check out our [other libraries on Github](https://github.com/apsislabs), and if you like our work you can [hire us](https://www.apsis.io) to build your vision.
@@ -3,7 +3,7 @@
3
3
  module PhiAttrs
4
4
  @@log_path = nil
5
5
  @@log_shift_age = 0 # Default to disabled
6
- @@log_shift_size = 1048576 # 1MB - Default from logger class
6
+ @@log_shift_size = 1_048_576 # 1MB - Default from logger class
7
7
  @@current_user_method = nil
8
8
  @@translation_prefix = 'phi'
9
9
 
@@ -112,7 +112,6 @@ module PhiAttrs
112
112
  return
113
113
  end
114
114
 
115
-
116
115
  # Enable PHI access for any instance of this class in the block given only
117
116
  # returning whatever the block returns.
118
117
  #
@@ -141,7 +140,7 @@ module PhiAttrs
141
140
  end
142
141
 
143
142
  # Save this so we don't revoke access previously extended outside the block
144
- frozen_instances = Hash[__instances_with_extended_phi.map { |obj| [obj, obj.instance_variable_get(:@__phi_relations_extended).clone] }]
143
+ frozen_instances = __instances_with_extended_phi.index_with { |obj| obj.instance_variable_get(:@__phi_relations_extended).clone }
145
144
 
146
145
  if allow_only.nil?
147
146
  allow_phi!(user_id, reason)
@@ -366,11 +365,10 @@ module PhiAttrs
366
365
  return
367
366
  end
368
367
 
369
-
370
368
  # Enable PHI access for a single instance of this class inside the block.
371
369
  # Returns whatever is returned from the block.
372
370
  # Nested calls to get_phi will log once per nested call
373
- #s
371
+ # s
374
372
  # @param [String] user_id A unique identifier for the person accessing the PHI
375
373
  # @param [String] reason The reason for accessing PHI
376
374
  # @yield The block in which phi access is allowed
@@ -462,7 +460,6 @@ module PhiAttrs
462
460
  end
463
461
  end
464
462
 
465
-
466
463
  # The unique identifier for whom access has been allowed on this instance.
467
464
  # This is what was passed in when PhiRecord#allow_phi! was called.
468
465
  #
@@ -627,21 +624,27 @@ module PhiAttrs
627
624
  # # through access logging.
628
625
  #
629
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
630
631
  return if self.class.__phi_methods_wrapped.include? method_name
631
632
 
632
633
  wrapped_method = :"__#{method_name}_phi_wrapped"
633
634
  unwrapped_method = :"__#{method_name}_phi_unwrapped"
634
635
 
635
- self.class.send(:define_method, wrapped_method) do |*args, &block|
636
+ self.class.send(:define_method, wrapped_method) do |*args, **kwargs, &block|
636
637
  PhiAttrs::Logger.tagged(*phi_log_keys) do
637
- raise PhiAttrs::Exceptions::PhiAccessException, "Attempted PHI access for #{self.class.name} #{@__phi_user_id}" unless phi_allowed?
638
+ unless phi_allowed?
639
+ raise PhiAttrs::Exceptions::PhiAccessException, "Attempted PHI access for #{self.class.name} #{@__phi_user_id}"
640
+ end
638
641
 
639
642
  unless all_phi_context_logged?
640
643
  PhiAttrs::Logger.info("#{self.class.name} access by [#{all_phi_allowed_by}]. Triggered by method: #{method_name}")
641
644
  set_all_phi_context_logged
642
645
  end
643
646
 
644
- send(unwrapped_method, *args, &block)
647
+ send(unwrapped_method, *args, **kwargs, &block)
645
648
  end
646
649
  end
647
650
 
@@ -660,23 +663,22 @@ module PhiAttrs
660
663
  # @private
661
664
  #
662
665
  def phi_wrap_extension(method_name)
666
+ raise NameError, "Undefined relationship in `extend_phi_access`: #{method_name}" unless respond_to?(method_name)
663
667
  return if self.class.__phi_methods_to_extend.include? method_name
664
668
 
665
669
  wrapped_method = wrapped_extended_name(method_name)
666
670
  unwrapped_method = unwrapped_extended_name(method_name)
667
671
 
668
- self.class.send(:define_method, wrapped_method) do |*args, &block|
669
- relation = send(unwrapped_method, *args, &block)
670
-
671
- if phi_allowed?
672
- if relation.present? && relation_klass(relation).included_modules.include?(PhiRecord)
673
- relations = relation.is_a?(Enumerable) ? relation : [relation]
674
- relations.each do |r|
675
- r.allow_phi!(phi_allowed_by, phi_access_reason) unless @__phi_relations_extended.include?(r)
676
- end
677
- @__phi_relations_extended.merge(relations)
678
- self.class.__instances_with_extended_phi.add(self)
672
+ self.class.send(:define_method, wrapped_method) do |*args, **kwargs, &block|
673
+ relation = send(unwrapped_method, *args, **kwargs, &block)
674
+
675
+ if phi_allowed? && (relation.present? && relation_klass(relation).included_modules.include?(PhiRecord))
676
+ relations = relation.is_a?(Enumerable) ? relation : [relation]
677
+ relations.each do |r|
678
+ r.allow_phi!(phi_allowed_by, phi_access_reason) unless @__phi_relations_extended.include?(r)
679
679
  end
680
+ @__phi_relations_extended.merge(relations)
681
+ self.class.__instances_with_extended_phi.add(self)
680
682
  end
681
683
 
682
684
  relation
@@ -7,8 +7,8 @@ module PhiAttrs
7
7
  class Railtie < Rails::Railtie
8
8
  initializer 'phi_attrs.initialize' do |_app|
9
9
  ActiveSupport.on_load(:active_record) do
10
- ActiveRecord::Base.send :extend, PhiAttrs::Model
11
- ActionController::Base.send :include, PhiAttrs::Controller
10
+ ActiveSupport.on_load(:active_record) { extend PhiAttrs::Model }
11
+ ActiveSupport.on_load(:action_controller) { include PhiAttrs::Controller }
12
12
  end
13
13
  end
14
14
  end
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rspec/expectations'
2
4
 
3
- DO_NOT_SPECIFY = "do not specify `allowed_by` or `with_access_reason` for negated `allow_phi_access`"
5
+ DO_NOT_SPECIFY = 'do not specify `allowed_by` or `with_access_reason` for negated `allow_phi_access`'
4
6
 
5
7
  RSpec::Matchers.define :allow_phi_access do
6
8
  match do |result|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PhiAttrs
4
- VERSION = '0.2.4'
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.2.4
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: 2022-12-22 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
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 4.2.0
19
+ version: 6.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 4.2.0
26
+ version: 6.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: request_store
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -54,34 +54,20 @@ dependencies:
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '2.0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '2.0'
69
- - !ruby/object:Gem::Dependency
70
- name: byebug
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
59
  - - ">="
74
60
  - !ruby/object:Gem::Version
75
- version: '0'
61
+ version: 2.2.33
76
62
  type: :development
77
63
  prerelease: false
78
64
  version_requirements: !ruby/object:Gem::Requirement
79
65
  requirements:
80
66
  - - ">="
81
67
  - !ruby/object:Gem::Version
82
- version: '0'
68
+ version: 2.2.33
83
69
  - !ruby/object:Gem::Dependency
84
- name: chandler
70
+ name: byebug
85
71
  requirement: !ruby/object:Gem::Requirement
86
72
  requirements:
87
73
  - - ">="
@@ -95,7 +81,7 @@ dependencies:
95
81
  - !ruby/object:Gem::Version
96
82
  version: '0'
97
83
  - !ruby/object:Gem::Dependency
98
- name: combustion
84
+ name: factory_bot_rails
99
85
  requirement: !ruby/object:Gem::Requirement
100
86
  requirements:
101
87
  - - ">="
@@ -109,7 +95,7 @@ dependencies:
109
95
  - !ruby/object:Gem::Version
110
96
  version: '0'
111
97
  - !ruby/object:Gem::Dependency
112
- name: factory_bot_rails
98
+ name: faker
113
99
  requirement: !ruby/object:Gem::Requirement
114
100
  requirements:
115
101
  - - ">="
@@ -123,7 +109,7 @@ dependencies:
123
109
  - !ruby/object:Gem::Version
124
110
  version: '0'
125
111
  - !ruby/object:Gem::Dependency
126
- name: faker
112
+ name: rake
127
113
  requirement: !ruby/object:Gem::Requirement
128
114
  requirements:
129
115
  - - ">="
@@ -137,7 +123,7 @@ dependencies:
137
123
  - !ruby/object:Gem::Version
138
124
  version: '0'
139
125
  - !ruby/object:Gem::Dependency
140
- name: rake
126
+ name: rubocop
141
127
  requirement: !ruby/object:Gem::Requirement
142
128
  requirements:
143
129
  - - ">="
@@ -151,35 +137,7 @@ dependencies:
151
137
  - !ruby/object:Gem::Version
152
138
  version: '0'
153
139
  - !ruby/object:Gem::Dependency
154
- name: rspec
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - "~>"
158
- - !ruby/object:Gem::Version
159
- version: '3.7'
160
- type: :development
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - "~>"
165
- - !ruby/object:Gem::Version
166
- version: '3.7'
167
- - !ruby/object:Gem::Dependency
168
- name: rspec-rails
169
- requirement: !ruby/object:Gem::Requirement
170
- requirements:
171
- - - "~>"
172
- - !ruby/object:Gem::Version
173
- version: '3.7'
174
- type: :development
175
- prerelease: false
176
- version_requirements: !ruby/object:Gem::Requirement
177
- requirements:
178
- - - "~>"
179
- - !ruby/object:Gem::Version
180
- version: '3.7'
181
- - !ruby/object:Gem::Dependency
182
- name: rubocop
140
+ name: rubocop-rails
183
141
  requirement: !ruby/object:Gem::Requirement
184
142
  requirements:
185
143
  - - ">="
@@ -227,32 +185,10 @@ executables: []
227
185
  extensions: []
228
186
  extra_rdoc_files: []
229
187
  files:
230
- - ".github/workflows/build.yml"
231
- - ".github/workflows/publish.yml"
232
- - ".gitignore"
233
- - ".rspec"
234
- - ".rubocop.yml"
235
- - Appraisals
236
188
  - CHANGELOG.md
237
189
  - DISCLAIMER.txt
238
- - Dockerfile
239
- - Gemfile
240
190
  - LICENSE.txt
241
191
  - README.md
242
- - Rakefile
243
- - bin/console
244
- - bin/helpers/docker
245
- - bin/rubo_fix
246
- - bin/run_tests
247
- - bin/setup
248
- - bin/ssh_to_container
249
- - config.ru
250
- - docker-compose.yml
251
- - docker/start.sh
252
- - gemfiles/.bundle/config
253
- - gemfiles/rails_5.1.gemfile
254
- - gemfiles/rails_5.2.gemfile
255
- - gemfiles/rails_6.0.gemfile
256
192
  - lib/phi_attrs.rb
257
193
  - lib/phi_attrs/configure.rb
258
194
  - lib/phi_attrs/exceptions.rb
@@ -262,11 +198,11 @@ files:
262
198
  - lib/phi_attrs/railtie.rb
263
199
  - lib/phi_attrs/rspec.rb
264
200
  - lib/phi_attrs/version.rb
265
- - phi_attrs.gemspec
266
201
  homepage: http://www.apsis.io
267
202
  licenses:
268
203
  - MIT
269
- metadata: {}
204
+ metadata:
205
+ rubygems_mfa_required: 'false'
270
206
  post_install_message: "\n Thank you for installing phi_attrs! By installing this
271
207
  gem,\n you acknowledge and agree to the disclaimer as provided in the\n DISCLAIMER.txt
272
208
  file.\n\n For full details, see: https://github.com/apsislabs/phi_attrs/blob/master/DISCLAIMER.txt\n
@@ -278,7 +214,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
278
214
  requirements:
279
215
  - - ">="
280
216
  - !ruby/object:Gem::Version
281
- version: '0'
217
+ version: 2.7.0
282
218
  required_rubygems_version: !ruby/object:Gem::Requirement
283
219
  requirements:
284
220
  - - ">="
@@ -1,24 +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
- ruby: [2.5, 2.6, 2.7]
12
-
13
- steps:
14
- - uses: actions/checkout@v3
15
- - name: Set up Ruby ${{ matrix.ruby }}
16
- uses: ruby/setup-ruby@v1
17
- with:
18
- ruby-version: ${{ matrix.ruby }}
19
- bundler-cache: true
20
- - name: Install dependencies
21
- run: |
22
- bundle exec appraisal install
23
- - name: Run rspec
24
- run: bundler exec appraisal 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: '2.6'
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,22 +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
- /test/sample/tmp/
15
- *.sqlite
16
- *.sqlite3
17
- *.log
18
- .rspec_status
19
- gemfiles/*.gemfile.lock
20
-
21
- # Macs. Ugh.
22
- .DS_Store
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
data/.rubocop.yml DELETED
@@ -1,91 +0,0 @@
1
- Rails:
2
- Enabled: true
3
-
4
- AllCops:
5
- Exclude:
6
- - 'bin/**/*'
7
- - 'gemfiles/**/*'
8
- - 'spec/internal/db/schema.rb'
9
- TargetRubyVersion: 2.5
10
-
11
- Documentation:
12
- Enabled: false
13
-
14
- Layout/IndentationWidth:
15
- Enabled: true
16
-
17
- Lint/UnreachableCode:
18
- Exclude:
19
- - 'lib/phi_attrs/phi_record.rb' # TODO: RUBOCOP Cleanup exclusion
20
-
21
- Lint/UnusedMethodArgument:
22
- Exclude:
23
- - 'lib/phi_attrs.rb' # TODO: RUBOCOP Cleanup exclusion
24
-
25
- Metrics/AbcSize:
26
- Max: 30
27
- Exclude:
28
- - 'spec/internal/db/**/*'
29
- - 'lib/phi_attrs/phi_record.rb' # TODO: RUBOCOP Cleanup exclusion
30
-
31
- Metrics/BlockLength:
32
- Enabled: false
33
-
34
- Metrics/ClassLength:
35
- Max: 1500
36
-
37
- Metrics/CyclomaticComplexity:
38
- Exclude:
39
- - 'lib/phi_attrs/phi_record.rb' # TODO: RUBOCOP Cleanup exclusion
40
-
41
- Metrics/LineLength:
42
- Exclude:
43
- - 'spec/**/*'
44
- - 'lib/phi_attrs/phi_record.rb' # TODO: RUBOCOP Cleanup exclusion
45
- Max: 140
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/EmptyMethod:
82
- EnforcedStyle: expanded
83
-
84
- Style/SymbolArray:
85
- EnforcedStyle: brackets
86
-
87
- Style/RedundantReturn:
88
- Enabled: false
89
-
90
- Style/WordArray:
91
- MinSize: 4
data/Appraisals DELETED
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- appraise 'rails-5.1' do
4
- gem 'rails', '5.1.3'
5
- gem 'sqlite3', '~> 1.3', '< 1.4'
6
- end
7
-
8
- appraise 'rails-5.2' do
9
- gem 'rails', '5.2.4'
10
- gem 'sqlite3', '~> 1.4'
11
- end
12
-
13
- appraise 'rails-6.0' do
14
- gem 'rails', '6.0.3'
15
- gem 'sqlite3', '~> 1.4'
16
- end
data/Dockerfile DELETED
@@ -1,16 +0,0 @@
1
- FROM ruby:2.5.3-alpine3.8
2
- MAINTAINER wyatt@apsis.io
3
-
4
- RUN apk add --no-cache --update \
5
- bash \
6
- alpine-sdk \
7
- sqlite-dev
8
-
9
- ENV APP_HOME /app
10
- WORKDIR $APP_HOME
11
-
12
- COPY . $APP_HOME/
13
-
14
- EXPOSE 3000
15
-
16
- 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,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler/gem_tasks'
4
- require 'rspec/core/rake_task'
5
-
6
- RSpec::Core::RakeTask.new(:spec)
7
-
8
- # Set Chandler options
9
- if defined? Chandler
10
- Chandler::Tasks.configure do |config|
11
- config.changelog_path = 'CHANGELOG.md'
12
- config.github_repository = 'apsislabs/phi_attrs'
13
- end
14
-
15
- # Add chandler as a prerequisite for `rake release`
16
- task 'release:rubygem_push' => 'chandler:push'
17
- end
18
-
19
- task default: :spec
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 rails
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 rails
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,3 +0,0 @@
1
- #! /bin/bash
2
-
3
- docker-compose run rails sh
data/config.ru DELETED
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "rubygems"
4
- require "bundler"
5
-
6
- Bundler.require :default, :development
7
-
8
- Combustion.initialize! :all
9
- run Combustion::Application
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,20 +0,0 @@
1
- version: '3'
2
-
3
- services:
4
- rails:
5
- build: .
6
- volumes:
7
- - bundle_cache:/bundle
8
- - .:/app
9
- environment:
10
- - BUNDLER_VERSION=2.1.4
11
- - BUNDLE_JOBS=5
12
- - BUNDLE_PATH=/bundle
13
- - BUNDLE_BIN=/bundle/bin
14
- - GEM_HOME=/bundle
15
- - DOCKER_CONTAINER=1
16
- command:
17
- - docker/start.sh
18
-
19
- volumes:
20
- bundle_cache:
@@ -1,2 +0,0 @@
1
- ---
2
- BUNDLE_RETRY: "1"
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rails", "5.1.3"
6
- gem "sqlite3", "~> 1.3", "< 1.4"
7
-
8
- gemspec path: "../"
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rails", "5.2.4"
6
- gem "sqlite3", "~> 1.4"
7
-
8
- gemspec path: "../"
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rails", "6.0.3"
6
- gem "sqlite3", "~> 1.4"
7
-
8
- 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 = %q`
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.files = `git ls-files -z`.split("\x0").reject do |f|
25
- f.match(%r{^(test|spec|features)/})
26
- end
27
- spec.bindir = 'exe'
28
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
- spec.require_paths = ['lib']
30
-
31
- spec.add_runtime_dependency 'rails', '>= 4.2.0'
32
- spec.add_runtime_dependency 'request_store', '~> 1.4'
33
-
34
- spec.add_development_dependency 'appraisal'
35
- spec.add_development_dependency 'bundler', '~> 2.0'
36
- spec.add_development_dependency 'byebug'
37
- spec.add_development_dependency 'chandler'
38
- spec.add_development_dependency 'combustion'
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 'rspec', '~> 3.7'
43
- spec.add_development_dependency 'rspec-rails', '~> 3.7'
44
- spec.add_development_dependency 'rubocop'
45
- spec.add_development_dependency 'simplecov', '~> 0.16'
46
- spec.add_development_dependency 'tzinfo-data'
47
- end