lucarecord 0.5.0 → 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: 7741bc3462c9b4bb661789bfb04d7b0ff72de0ac799ffd94f392024601f01252
4
- data.tar.gz: '0396d2996311932d601f30f971bee36f85e1b361339371c2075c1a2accac80be'
3
+ metadata.gz: cf1f2de4d31ac30fa0e7e2a54d2391c04a0aec3008f0d141fd5d887b39f1e8eb
4
+ data.tar.gz: f50d14c026db0bd94007bff1e35ab0ff65b6e6a34f97ce282fa8b2dd53adc909
5
5
  SHA512:
6
- metadata.gz: bfee9c41fca0234febda5614cca159b3b6b3d7c02215f216604dd0fc1a65e54ba819656ecf340a063b64115c86dbd83c424da2ba58bd3efb154b567801552dfe
7
- data.tar.gz: 7c5b56ee7275218ba98c95cd75203f252243b5cfb304e0d6b6302e99d7cda7bf791b8400684ecdc762d7a3a8215d6dde0c9887215dedaa798a5397feac2e77a2
6
+ metadata.gz: 152215ed2b331ea30afc08b137b938231d6b40c3254bc8ea99f6cb540bba5727cf3e7b043b5002872ce8c814716c266a2f6f536880f2fdb01d674af6da1e76c7
7
+ data.tar.gz: 951a08656f3f50e95d58ad724c5f998f23e34d45c8453e79ff297ba059e4ed9e9f176455c1f335d8ed1a52e7545fbb7c5224a1a5862af81c4072ae4c66ac6900
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
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
+
9
+ ## LucaRecord 0.5.1
10
+
11
+ * add `--enable-local-file-access` option to `wkhtmltopdf` command.
12
+
1
13
  ## LucaRecord 0.5.0
2
14
 
3
15
  * Exclude mail gem from dependencies. Just install it separately if you use mail functionality.
@@ -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.0'
4
+ VERSION = '0.5.3'
5
5
  end
@@ -29,8 +29,8 @@ module LucaSupport
29
29
  # Requires wkhtmltopdf command
30
30
  #
31
31
  def html2pdf(html_dat)
32
- out, err, stat = Open3.capture3('wkhtmltopdf - -', stdin_data: html_dat)
33
- puts err
32
+ out, err, stat = Open3.capture3('wkhtmltopdf --enable-local-file-access - -', stdin_data: html_dat)
33
+ STDERR.puts err
34
34
  out
35
35
  end
36
36
 
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.0
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chuma Takahiro
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-05-19 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
@@ -96,7 +96,7 @@ 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
99
+ rubygems_version: 3.4.1
100
100
  signing_key:
101
101
  specification_version: 4
102
102
  summary: ERP File operation framework