lucarecord 0.2.28 → 0.5.0
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 +12 -0
- data/lib/luca_record/dict.rb +2 -1
- data/lib/luca_record/io.rb +9 -3
- data/lib/luca_record/version.rb +1 -1
- data/lib/luca_support/config.rb +2 -1
- metadata +4 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7741bc3462c9b4bb661789bfb04d7b0ff72de0ac799ffd94f392024601f01252
|
4
|
+
data.tar.gz: '0396d2996311932d601f30f971bee36f85e1b361339371c2075c1a2accac80be'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bfee9c41fca0234febda5614cca159b3b6b3d7c02215f216604dd0fc1a65e54ba819656ecf340a063b64115c86dbd83c424da2ba58bd3efb154b567801552dfe
|
7
|
+
data.tar.gz: 7c5b56ee7275218ba98c95cd75203f252243b5cfb304e0d6b6302e99d7cda7bf791b8400684ecdc762d7a3a8215d6dde0c9887215dedaa798a5397feac2e77a2
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
## LucaRecord 0.5.0
|
2
|
+
|
3
|
+
* Exclude mail gem from dependencies. Just install it separately if you use mail functionality.
|
4
|
+
|
5
|
+
## LucaRecord 0.4.0
|
6
|
+
|
7
|
+
* Replace YAML.load/load_file to YAML.safe_load for compatibility with Ruby 3.1
|
8
|
+
|
9
|
+
## LucaRecord 0.3.0
|
10
|
+
|
11
|
+
* implement LucaRecord::IO.latest_month
|
12
|
+
|
1
13
|
## LucaRecord 0.2.28
|
2
14
|
|
3
15
|
* implement LucaSupport::Range, handle #by_month enumeration between several months.
|
data/lib/luca_record/dict.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'csv'
|
4
|
+
require 'date'
|
4
5
|
require 'fileutils'
|
5
6
|
require 'yaml'
|
6
7
|
require 'pathname'
|
@@ -71,7 +72,7 @@ module LucaRecord
|
|
71
72
|
when '.tsv', '.csv'
|
72
73
|
load_tsv_dict(dict_path(file))
|
73
74
|
when '.yaml', '.yml'
|
74
|
-
YAML.
|
75
|
+
YAML.safe_load(File.read(dict_path(file)), permitted_classes: [Date])
|
75
76
|
else
|
76
77
|
raise 'cannot load this filetype'
|
77
78
|
end
|
data/lib/luca_record/io.rb
CHANGED
@@ -90,6 +90,12 @@ module LucaRecord # :nodoc:
|
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
|
+
# [year, month] pair of the latest record
|
94
|
+
#
|
95
|
+
def latest_month(code = nil, basedir = @dirname)
|
96
|
+
LucaSupport::Code.decode_term(Dir.entries(abs_path(basedir)).max)
|
97
|
+
end
|
98
|
+
|
93
99
|
# ----------------------------------------------------------------
|
94
100
|
# :section: Write Methods
|
95
101
|
# <tt>basedir</tt> is set by class instance variable <tt>@dirname</tt>
|
@@ -144,7 +150,7 @@ module LucaRecord # :nodoc:
|
|
144
150
|
|
145
151
|
def add_status!(id, status, basedir = @dirname)
|
146
152
|
path = abs_path(basedir) / id2path(id)
|
147
|
-
origin = YAML.
|
153
|
+
origin = YAML.safe_load(File.read(path), permitted_classes: [Date])
|
148
154
|
newline = { status => DateTime.now.to_s }
|
149
155
|
origin['status'] = [] if origin['status'].nil?
|
150
156
|
origin['status'] << newline
|
@@ -356,7 +362,7 @@ module LucaRecord # :nodoc:
|
|
356
362
|
# TODO: implement JSON parse
|
357
363
|
end
|
358
364
|
else
|
359
|
-
LucaSupport::Code.decimalize(YAML.
|
365
|
+
LucaSupport::Code.decimalize(YAML.safe_load(io.read, permitted_classes: [Date])).tap { |obj| validate_keys(obj) }
|
360
366
|
end
|
361
367
|
end
|
362
368
|
|
@@ -428,7 +434,7 @@ module LucaRecord # :nodoc:
|
|
428
434
|
def load_config(path = nil)
|
429
435
|
path = path.to_s
|
430
436
|
if File.exist?(path)
|
431
|
-
YAML.
|
437
|
+
YAML.safe_load(File.read(path), permitted_classes: [Date])
|
432
438
|
else
|
433
439
|
{}
|
434
440
|
end
|
data/lib/luca_record/version.rb
CHANGED
data/lib/luca_support/config.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'date'
|
3
4
|
require 'pathname'
|
4
5
|
require 'yaml'
|
5
6
|
|
@@ -11,7 +12,7 @@ module LucaSupport
|
|
11
12
|
{
|
12
13
|
'decimal_separator' => '.',
|
13
14
|
'thousands_separator' => ','
|
14
|
-
}.merge(YAML.
|
15
|
+
}.merge(YAML.safe_load(File.read(Pathname(PJDIR) / 'config.yml'), permitted_classes: [Date]))
|
15
16
|
rescue Errno::ENOENT
|
16
17
|
{
|
17
18
|
'decimal_separator' => '.',
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lucarecord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chuma Takahiro
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: mail
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: bundler
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -68,7 +54,7 @@ dependencies:
|
|
68
54
|
version: 12.3.3
|
69
55
|
description: 'ERP File operation framework
|
70
56
|
|
71
|
-
'
|
57
|
+
'
|
72
58
|
email:
|
73
59
|
- co.chuma@gmail.com
|
74
60
|
executables: []
|
@@ -110,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
96
|
- !ruby/object:Gem::Version
|
111
97
|
version: '0'
|
112
98
|
requirements: []
|
113
|
-
rubygems_version: 3.
|
99
|
+
rubygems_version: 3.3.5
|
114
100
|
signing_key:
|
115
101
|
specification_version: 4
|
116
102
|
summary: ERP File operation framework
|