dynarex-daily 0.5.1 → 0.7.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
- checksums.yaml.gz.sig +0 -0
- data/lib/dynarex-daily.rb +43 -34
- data.tar.gz.sig +0 -0
- metadata +7 -7
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e5f46eeebb7b92758dc6bd8690ef5ac0117abf18b8d79b8c6c342c724fa384a
|
4
|
+
data.tar.gz: a359ed5ceb7684d678d1b6b0dcdcef68f70498c1e79a9fd3c27c68306c27f80a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b7c623a33a4fd818f0b1bf47f86c42f8972f89123480a7199a22e243ca70c65cd426ecd6d719ccdbc0e1cd6153004acbe3e389411d34e5c8f42bab4931c9bbc
|
7
|
+
data.tar.gz: bf79901a76421f628c1807a3fdde16b5278d67ce5402b602bf75fc4b115085887efb6a0725d5228c63b3844b316975d743cf1ce1c32ce6a2368c0e647d5ce39b
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/dynarex-daily.rb
CHANGED
@@ -6,82 +6,88 @@ require 'dynarex'
|
|
6
6
|
require 'rxfileio'
|
7
7
|
|
8
8
|
|
9
|
-
class DynarexDaily < Dynarex
|
9
|
+
class DynarexDaily < Dynarex
|
10
10
|
include RXFileIOModule
|
11
|
-
|
12
|
-
def initialize(stringx=nil, dir_archive: :days, xslt: '',
|
13
|
-
filename: 'dynarexdaily.xml',
|
14
|
-
|
11
|
+
|
12
|
+
def initialize(stringx=nil, dir_archive: :days, xslt: '',
|
13
|
+
filename: 'dynarexdaily.xml', fields: %i(desc),
|
14
|
+
autosave: false, order: 'ascending', debug: false)
|
15
|
+
|
15
16
|
@dir_archive = dir_archive
|
16
17
|
|
17
18
|
@filename = filename
|
18
|
-
@schema = 'entries[date]/entry(time,
|
19
|
+
@schema = 'entries[date]/entry(time, ' + fields.join(', ') + ')'
|
19
20
|
@default_key = 'uid'
|
20
21
|
@debug = debug
|
21
22
|
|
22
23
|
puts 'DynarexDaily::initialize stringx: ' + stringx.inspect if @debug
|
23
|
-
|
24
|
+
|
24
25
|
if stringx then
|
25
26
|
s, type = RXFReader.read(stringx)
|
26
27
|
@filename = stringx if type == :file or type == :dfs
|
27
28
|
end
|
28
|
-
|
29
|
+
|
29
30
|
puts 'DynarexDaily::initialize @filename: ' + @filename.inspect if @debug
|
30
|
-
|
31
|
-
if FileX.
|
32
|
-
|
31
|
+
|
32
|
+
if FileX.exist?(@filename) then
|
33
|
+
|
34
|
+
puts 'file exists!' if @debug
|
33
35
|
super @filename, debug: debug
|
34
|
-
|
36
|
+
|
35
37
|
if !summary[:date].empty? and \
|
36
38
|
Date.parse(summary[:date]) != Date.today then
|
37
|
-
|
39
|
+
|
38
40
|
archive_file Date.parse(summary[:date])
|
39
41
|
create_file
|
40
|
-
end
|
41
|
-
|
42
|
+
end
|
43
|
+
|
42
44
|
else
|
43
45
|
puts 'before super: stringx: ' + stringx.inspect if @debug
|
44
|
-
super( stringx || @schema , debug: debug)
|
46
|
+
super( stringx || @schema , order: order, debug: debug)
|
45
47
|
puts 'after super' if @debug
|
46
|
-
@delimiter = ' # '
|
48
|
+
@delimiter = ' # '
|
47
49
|
create_file
|
48
50
|
end
|
51
|
+
|
52
|
+
@autosave = autosave
|
49
53
|
|
50
54
|
self.xslt = xslt if xslt
|
51
55
|
end
|
52
56
|
|
53
57
|
def create(h)
|
58
|
+
|
59
|
+
puts 'Date.today: ' + Date.today.inspect if @debug
|
54
60
|
|
55
61
|
if !summary[:date].empty? and \
|
56
62
|
Date.parse(summary[:date]) != Date.today then
|
57
|
-
|
63
|
+
|
58
64
|
archive_file Date.parse(summary[:date])
|
59
65
|
create_file
|
60
|
-
end
|
61
|
-
|
62
|
-
super(h)
|
66
|
+
end
|
67
|
+
|
68
|
+
super({time: Time.now.to_f.to_s}.merge(h))
|
63
69
|
end
|
64
|
-
|
65
|
-
|
70
|
+
|
71
|
+
|
66
72
|
def save(filename=@filename, options={})
|
67
73
|
|
68
74
|
puts 'inside DynarexDaily::save() filename: ' + filename.inspect if @debug
|
69
75
|
super(filename, options)
|
70
76
|
|
71
77
|
end
|
72
|
-
|
78
|
+
|
73
79
|
def schema=(s)
|
74
80
|
super(s.sub(/^\w+(?=\/)/,'\0[date]'))
|
75
81
|
summary[:date] = Date.today.to_s
|
76
|
-
summary[:order] = 'descending'
|
82
|
+
summary[:order] = 'descending'
|
77
83
|
end
|
78
84
|
|
79
85
|
private
|
80
|
-
|
86
|
+
|
81
87
|
def create_file()
|
82
|
-
|
83
|
-
puts 'inside DynarexDaily::create_file' if @debug
|
84
|
-
|
88
|
+
|
89
|
+
puts 'inside DynarexDaily::create_file' if @debug
|
90
|
+
|
85
91
|
openx(@schema)
|
86
92
|
summary[:date] = Date.today.to_s
|
87
93
|
summary[:order] = 'descending'
|
@@ -91,26 +97,29 @@ class DynarexDaily < Dynarex
|
|
91
97
|
|
92
98
|
def archive_file(t)
|
93
99
|
|
94
|
-
puts 'inside DynarexDaily::archive_file' if @debug
|
95
|
-
|
100
|
+
puts 'inside DynarexDaily::archive_file' if @debug
|
101
|
+
|
96
102
|
dir, file = if @dir_archive == :days then
|
103
|
+
puts 'days archive' if @debug
|
97
104
|
['days', t.strftime("d%d%m%y.xml")]
|
98
105
|
else
|
106
|
+
puts 'other archive' if @debug
|
99
107
|
[t.strftime("%Y/%b/%d").downcase, 'index.xml']
|
100
108
|
end
|
101
109
|
|
110
|
+
puts 'about to mkdir ' + dir.inspect if @debug
|
102
111
|
FileX.mkdir_p dir unless FileX.exist? dir
|
103
|
-
|
112
|
+
|
104
113
|
if @debug then
|
105
114
|
puts 'inside DynarexDaily::archive_file '
|
106
115
|
puts ' @filename: %s' % [@filename]
|
107
116
|
puts ' dir: %s; file: %s' % [dir, file]
|
108
117
|
puts ' FileX: %s' % [dir, FileX.pwd]
|
109
118
|
end
|
110
|
-
|
119
|
+
|
111
120
|
FileX.mv(@filename, "%s/%s" % [dir, file])
|
112
121
|
puts 'inside DynarexDaily::archive_file after FileX.mv' if @debug
|
113
|
-
|
122
|
+
|
114
123
|
end
|
115
124
|
|
116
125
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dynarex-daily
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
E/GgkjQ28u/f6qcQgMPVvPiO6Ku2M2Zp4D5AL6Pb4ipSACsLEZZHMWo/CJBLOQ7f
|
36
36
|
KYgoP6fr0Bkw0gyMZIHEwNMH
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date:
|
38
|
+
date: 2023-02-13 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: dynarex
|
@@ -43,20 +43,20 @@ dependencies:
|
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '1.
|
46
|
+
version: '1.10'
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: 1.
|
49
|
+
version: 1.10.0
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
54
|
- - "~>"
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: '1.
|
56
|
+
version: '1.10'
|
57
57
|
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: 1.
|
59
|
+
version: 1.10.0
|
60
60
|
description:
|
61
61
|
email: digital.robertson@gmail.com
|
62
62
|
executables: []
|
@@ -83,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
83
|
- !ruby/object:Gem::Version
|
84
84
|
version: '0'
|
85
85
|
requirements: []
|
86
|
-
rubygems_version: 3.
|
86
|
+
rubygems_version: 3.4.4
|
87
87
|
signing_key:
|
88
88
|
specification_version: 4
|
89
89
|
summary: A Dynarex flavoured log file for humans which is archived daily
|
metadata.gz.sig
CHANGED
Binary file
|