lucarecord 0.5.1 → 0.5.3
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 +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/luca_record/io.rb +42 -0
- data/lib/luca_record/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf1f2de4d31ac30fa0e7e2a54d2391c04a0aec3008f0d141fd5d887b39f1e8eb
|
4
|
+
data.tar.gz: f50d14c026db0bd94007bff1e35ab0ff65b6e6a34f97ce282fa8b2dd53adc909
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 152215ed2b331ea30afc08b137b938231d6b40c3254bc8ea99f6cb540bba5727cf3e7b043b5002872ce8c814716c266a2f6f536880f2fdb01d674af6da1e76c7
|
7
|
+
data.tar.gz: 951a08656f3f50e95d58ad724c5f998f23e34d45c8453e79ff297ba059e4ed9e9f176455c1f335d8ed1a52e7545fbb7c5224a1a5862af81c4072ae4c66ac6900
|
data/CHANGELOG.md
CHANGED
data/lib/luca_record/io.rb
CHANGED
@@ -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)
|
data/lib/luca_record/version.rb
CHANGED
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.
|
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:
|
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.
|
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: []
|