ndr_pseudonymise 0.4.1 → 0.4.2

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: cdbd09c95ec2fa5a5fdb791a177654ae9c9cc520a1461c1df54cc5035c001c66
4
- data.tar.gz: 3bb60274d7eed27d033bb7efca0262d48c0e8d322b6708eb0d6ddb37a9673a2a
3
+ metadata.gz: de8ff4d87384ab58d1e16263095f619dc03269d4342829fd47cfc2dff98d539d
4
+ data.tar.gz: 4186c0f859293592e4f78d3acbd000a3caad604c3e0129979f02aba3a036b55c
5
5
  SHA512:
6
- metadata.gz: 7180d2bf8a99f0b5493e0204bf9f3dff7100f8663f1560b2b207a05fa235431674b60490093cbd6eeef5e350ad7460f470ad895d71d3506b71d73dd29e52ad3b
7
- data.tar.gz: 3261dcbbd12a6770d7d03e76bb84aa6e327de4b0acaec762e0650e5d8ba4425f5780ef051e8ef2a7063d5327ba8e28b1539ad4587520d0484d239377916d1555
6
+ metadata.gz: 9ccfc71d5b259a5694bd96fb06e4014977e5d1287ff8f816bf46f59b12b40c83e1f31a327c4c37e8434d477df34c9b4f9391c769e294739ee6bc6d197ee503c3
7
+ data.tar.gz: f3b2aab13ee7ab67bb398d0c5c5966452afa9e42aa809b787ad668c84d6af1ad78cc45bff27adb342f31651f4f88cd60101341ce2275c2afe7ab39131835423a
data/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  ## [Unreleased]
2
2
  * No unreleased changes
3
3
 
4
+ ## 0.4.2 / 2022-10-25
5
+ ## Changed
6
+ * ndr_encrypt add recursively includes directory contents
7
+
4
8
  ## 0.4.1 / 2022-10-18
5
9
  ## Added
6
10
  # Add ndr_encrypt utility script for image encryption.
@@ -1,5 +1,6 @@
1
1
  require 'csv'
2
2
  require 'fileutils'
3
+ require 'find'
3
4
  require 'set'
4
5
  require 'stringio'
5
6
 
@@ -35,9 +36,16 @@ module NdrPseudonymise
35
36
  raise(ArgumentError, 'Invalid ndr_encrypted encrypted store') unless valid_repository?
36
37
 
37
38
  paths.each do |path|
38
- git_blobid, _encrypted_id = hash_object(path,
39
- key_name: key_name, pub_key: pub_key, write: true)
40
- File.open(index_filename, 'ab') { |f| f << [git_blobid, path].to_csv }
39
+ Find.find(path) do |fn|
40
+ next unless File.file?(fn)
41
+
42
+ real_encrypted_dir = File.realdirpath(File.join(@repo_dir, ENCRYPTED_DIR))
43
+ next if File.realdirpath(fn).start_with?(real_encrypted_dir)
44
+
45
+ git_blobid, _encrypted_id = hash_object(fn, key_name: key_name,
46
+ pub_key: pub_key, write: true)
47
+ File.open(index_filename, 'ab') { |f| f << [git_blobid, fn].to_csv }
48
+ end
41
49
  end
42
50
  end
43
51
 
@@ -1,3 +1,3 @@
1
1
  module NdrPseudonymise
2
- VERSION = '0.4.1'.freeze
2
+ VERSION = '0.4.2'.freeze
3
3
  end
@@ -27,10 +27,12 @@ Gem::Specification.new do |spec|
27
27
  spec.add_development_dependency 'bundler'
28
28
  spec.add_development_dependency 'minitest', '>= 5.0'
29
29
  spec.add_development_dependency 'mocha'
30
- spec.add_development_dependency 'ndr_dev_support', '>= 6.0'
30
+ spec.add_development_dependency 'ndr_dev_support', '>= 1.1'
31
31
  spec.add_development_dependency 'ndr_import'
32
32
  spec.add_development_dependency 'pry'
33
33
  spec.add_development_dependency 'rake', '>= 12.3.3'
34
34
 
35
- spec.required_ruby_version = '>= 2.6.0'
35
+ # Ruby 2.6.0 or later expected for normal operation, and needed for testing,
36
+ # but we support 2.0.0 for the ndr_encrypt utility
37
+ spec.required_ruby_version = '>= 2.0.0'
36
38
  end
@@ -4,6 +4,21 @@
4
4
  retrieved safely. The files still need to be hosted securely, but public /
5
5
  private key encryption provides additional protection.
6
6
 
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'ndr_pseudonymise'
13
+ ```
14
+
15
+ or for command line usage only, without installing any gems:
16
+
17
+ ``` shell
18
+ $ git clone https://github.com/NHSDigital/ndr_pseudonymise.git
19
+ $ ndr_pseudonymise/script/ndr_encrypt/ndr_encrypt --help
20
+ ```
21
+
7
22
  ## Overview
8
23
 
9
24
  We define a simple suite of tools, `ndr_encrypt`, to generate the encrypted
@@ -81,6 +96,8 @@ BASE64
81
96
 
82
97
  # Add the object to the repository
83
98
  ndr_encrypt add --key_name=ourkey1 --pub_key=ourkey1.pub test/dir/ok.gif
99
+ # or add the directory contents recursively
100
+ # ndr_encrypt add --key_name=ourkey1 --pub_key=ourkey1.pub test
84
101
 
85
102
  # Move aside the original file, to test recovery
86
103
  mv test/dir/ok.gif{,.orig}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ndr_pseudonymise
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - NCRS development team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-18 00:00:00.000000000 Z
11
+ date: 2022-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: '6.0'
89
+ version: '1.1'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: '6.0'
96
+ version: '1.1'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: ndr_import
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -183,7 +183,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
183
183
  requirements:
184
184
  - - ">="
185
185
  - !ruby/object:Gem::Version
186
- version: 2.6.0
186
+ version: 2.0.0
187
187
  required_rubygems_version: !ruby/object:Gem::Requirement
188
188
  requirements:
189
189
  - - ">="