lucarecord 0.7.3 → 0.7.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/luca_record/dict.rb +1 -1
- data/lib/luca_record/io.rb +1 -1
- data/lib/luca_record/version.rb +1 -1
- data/lib/luca_support/code.rb +6 -6
- data/lib/luca_support/enc.rb +8 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc67fbc3655278f3be52dd82f3994560fa72f3f043f272d40c1bd478a04e6126
|
4
|
+
data.tar.gz: aaff85cd17e1066344c915326b8626d312ae4add22263e198084979d624750f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e801b4ea786880fc442bbdf8c995abf1828f2a3e6ed705b8983178687da605d738dbaed3832c08bb718c7c5f23d4a540f43a55e4bd3cd51a395727ec08755e28
|
7
|
+
data.tar.gz: 9367c58a1b4ae9563f91f603f82dfdd9c674b2931cde3677e9d6ac4bc22eb3563e5bc6bf7a9fb4550473d19e319c78f0abe8c77cc1ff8b798848577b4c0fbcb0
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## LucaRecord 0.7.5
|
2
|
+
|
3
|
+
* `LucaSupport::Code.parse_current() / take_current()` now accepts Date object.
|
4
|
+
|
5
|
+
## LucaRecord 0.7.4
|
6
|
+
|
7
|
+
* `LucaSupport::ENC.encrypt() / decrypt()` use env `LUCA_ENC_PASSWORD` for automation.
|
8
|
+
|
1
9
|
## LucaRecord 0.7.3
|
2
10
|
|
3
11
|
* 'config/' inside the project data dir is now used as a primary configuration dir.
|
data/lib/luca_record/dict.rb
CHANGED
data/lib/luca_record/io.rb
CHANGED
@@ -372,7 +372,7 @@ module LucaRecord # :nodoc:
|
|
372
372
|
# '2020': All month of 2020
|
373
373
|
# '2020[FG]': June & July of 2020
|
374
374
|
#
|
375
|
-
# Block will receive code fragments as 2nd parameter. Array format is
|
375
|
+
# Block will receive code fragments as 2nd parameter. Array format is:
|
376
376
|
# 1. encoded month
|
377
377
|
# 2. encoded day + record number of the day
|
378
378
|
# 3. codes. More than 3 are all code set except first 2 parameters.
|
data/lib/luca_record/version.rb
CHANGED
data/lib/luca_support/code.rb
CHANGED
@@ -183,14 +183,14 @@ module LucaSupport # :nodoc:
|
|
183
183
|
# convert effective/defunct data into current hash on @date.
|
184
184
|
# not parse nested children.
|
185
185
|
#
|
186
|
-
def parse_current(dat)
|
186
|
+
def parse_current(dat, date = @date)
|
187
187
|
{}.tap do |processed|
|
188
|
-
dat.each { |k, _v| processed[k] = take_current(dat, k) }
|
188
|
+
dat.each { |k, _v| processed[k] = take_current(dat, k, date) }
|
189
189
|
end
|
190
190
|
end
|
191
191
|
|
192
192
|
# return current value with effective/defunct on target @date
|
193
|
-
# For multiple attribues, return hash on other than 'val'. Examples
|
193
|
+
# For multiple attribues, return hash on other than 'val'. Examples:
|
194
194
|
#
|
195
195
|
# - effective: 2020-1-1
|
196
196
|
# val: 3000
|
@@ -205,7 +205,7 @@ module LucaSupport # :nodoc:
|
|
205
205
|
# val: 3000
|
206
206
|
# => nil
|
207
207
|
#
|
208
|
-
def take_current(dat, item)
|
208
|
+
def take_current(dat, item, date = @date)
|
209
209
|
target = dat&.dig(item)
|
210
210
|
return target unless target.is_a?(Array)
|
211
211
|
|
@@ -213,8 +213,8 @@ module LucaSupport # :nodoc:
|
|
213
213
|
return target if !keys.include?('effective') && !keys.include?('defunct')
|
214
214
|
|
215
215
|
latest = target
|
216
|
-
.reject { |a| a['defunct'] && Date.parse(a['defunct'].to_s) <
|
217
|
-
.filter { |a| a['effective'] && Date.parse(a['effective'].to_s) <
|
216
|
+
.reject { |a| a['defunct'] && Date.parse(a['defunct'].to_s) < date }
|
217
|
+
.filter { |a| a['effective'] && Date.parse(a['effective'].to_s) < date }
|
218
218
|
.max { |a, b| Date.parse(a['effective'].to_s) <=> Date.parse(b['effective'].to_s) }
|
219
219
|
|
220
220
|
latest&.dig('val') || latest
|
data/lib/luca_support/enc.rb
CHANGED
@@ -13,8 +13,11 @@ module LucaSupport # :nodoc:
|
|
13
13
|
# TODO: check space in dir string
|
14
14
|
# TODO: check if origin exists
|
15
15
|
def encrypt(dir, iter: 10000, cleanup: false)
|
16
|
+
passopt = ENV['LUCA_ENC_PASSWORD'] ? "-pass pass:#{ENV['LUCA_ENC_PASSWORD']}" : ''
|
16
17
|
Dir.chdir(Pathname(CONST.pjdir) / 'data') do
|
17
|
-
|
18
|
+
abort "Directory #{dir} not found. exit..." unless Dir.exist?(dir)
|
19
|
+
|
20
|
+
system "tar czf - #{dir} | openssl enc -e -aes256 -iter #{iter} -out #{dir}.tar.gz #{passopt}"
|
18
21
|
return if ! cleanup
|
19
22
|
|
20
23
|
FileUtils.rm_rf dir
|
@@ -23,8 +26,11 @@ module LucaSupport # :nodoc:
|
|
23
26
|
|
24
27
|
# TODO: check space in dir string
|
25
28
|
def decrypt(dir, iter: 10000)
|
29
|
+
passopt = ENV['LUCA_ENC_PASSWORD'] ? "-pass pass:#{ENV['LUCA_ENC_PASSWORD']}" : ''
|
26
30
|
Dir.chdir(Pathname(CONST.pjdir) / 'data') do
|
27
|
-
|
31
|
+
abort "Archive #{dir}.tar.gz not found. exit..." unless File.exist?("#{dir}.tar.gz")
|
32
|
+
|
33
|
+
system "openssl enc -d -aes256 -iter #{iter} -in #{dir}.tar.gz #{passopt} | tar xz"
|
28
34
|
end
|
29
35
|
end
|
30
36
|
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.7.
|
4
|
+
version: 0.7.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chuma Takahiro
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|