lucarecord 0.5.1 → 0.5.3

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: a08f1701d74d851bed03a7715a3732cdd7250c7ea819785965a7bfbb612d5ded
4
- data.tar.gz: a0859eae9aeef68a80eac597c5f2fe3b1cf3f72c285b22451b0312df99f98d98
3
+ metadata.gz: cf1f2de4d31ac30fa0e7e2a54d2391c04a0aec3008f0d141fd5d887b39f1e8eb
4
+ data.tar.gz: f50d14c026db0bd94007bff1e35ab0ff65b6e6a34f97ce282fa8b2dd53adc909
5
5
  SHA512:
6
- metadata.gz: 40b5cebc5335ca1d7f67f47c73b5964614fb576e5acd3788d82cabd35df8552552584e5d6a218841c3ea69109bb950879d039e94801126c2f6b789c81fde646a
7
- data.tar.gz: fc64a3de02ddc1b61f8806999ddc20fff4199ee836a0a9b612f0172f710ebb4ebe976424f1a22b136438074797a6cf96bb5b2372499ac5cb29f80123c50d4091
6
+ metadata.gz: 152215ed2b331ea30afc08b137b938231d6b40c3254bc8ea99f6cb540bba5727cf3e7b043b5002872ce8c814716c266a2f6f536880f2fdb01d674af6da1e76c7
7
+ data.tar.gz: 951a08656f3f50e95d58ad724c5f998f23e34d45c8453e79ff297ba059e4ed9e9f176455c1f335d8ed1a52e7545fbb7c5224a1a5862af81c4072ae4c66ac6900
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## LucaRecord 0.5.3
2
+
3
+ * add `find_secure()` for partial data encryption.
4
+
5
+ ## LucaRecord 0.5.2
6
+
7
+ * add `update_record()` by `open_records()` id_set.
8
+
1
9
  ## LucaRecord 0.5.1
2
10
 
3
11
  * add `--enable-local-file-access` option to `wkhtmltopdf` command.
@@ -46,6 +46,37 @@ module LucaRecord # :nodoc:
46
46
  end
47
47
  end
48
48
 
49
+ # Merge 2 files under plain & prefixed dirs.
50
+ # prefixed contents will override duplicated keys.
51
+ # This function does not provide encryption/decryption.
52
+ #
53
+ def find_secure(id, basedir = @dirname, prefix = 's_')
54
+ if id.length >= 40
55
+ plain = open_hashed(basedir, id) do |f|
56
+ load_data(f)
57
+ end
58
+ secure = begin
59
+ open_hashed("#{prefix}#{basedir}", id) do |f|
60
+ load_data(f)
61
+ end
62
+ rescue
63
+ # No file exists, and so on.
64
+ {}
65
+ end
66
+ elsif id.length >= 7
67
+ parts = id.split('/')
68
+ plain = open_records(basedir, parts[0], parts[1]) do |f|
69
+ load_data(f)
70
+ end
71
+ secure = open_records("#{prefix}#{basedir}", parts[0], parts[1]) do |f|
72
+ load_data(f)
73
+ end
74
+ else
75
+ raise 'specified id length is too short'
76
+ end
77
+ plain.merge(secure)
78
+ end
79
+
49
80
  # search date based record.
50
81
  #
51
82
  # * data hash
@@ -311,6 +342,17 @@ module LucaRecord # :nodoc:
311
342
  end
312
343
  end
313
344
 
345
+ # Write record with id_set supplied by open_records().
346
+ #
347
+ def update_record(basedir, id_set, content)
348
+ raise "path fragments are too short" if id_set.length < 2
349
+
350
+ ::IO.write(
351
+ abs_path(basedir) / id_set[0] / id_set[1..-1].join('-'),
352
+ content
353
+ )
354
+ end
355
+
314
356
  # Calculate md5sum with original digest, file content and filename(optional).
315
357
  #
316
358
  def update_digest(digest, str, filename = nil)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LucaRecord
4
- VERSION = '0.5.1'
4
+ VERSION = '0.5.3'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lucarecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chuma Takahiro
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-05-26 00:00:00.000000000 Z
11
+ date: 2023-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -81,7 +81,7 @@ metadata:
81
81
  homepage_uri: https://github.com/chumaltd/luca/tree/master/lucarecord
82
82
  source_code_uri: https://github.com/chumaltd/luca/tree/master/lucarecord
83
83
  changelog_uri: https://github.com/chumaltd/luca/tree/master/lucarecord/CHANGELOG.md
84
- post_install_message:
84
+ post_install_message:
85
85
  rdoc_options: []
86
86
  require_paths:
87
87
  - lib
@@ -96,8 +96,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
98
  requirements: []
99
- rubygems_version: 3.3.5
100
- signing_key:
99
+ rubygems_version: 3.4.1
100
+ signing_key:
101
101
  specification_version: 4
102
102
  summary: ERP File operation framework
103
103
  test_files: []