kvx 0.9.0 → 0.9.5
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.tar.gz.sig +0 -0
- data/lib/kvx.rb +64 -12
- metadata +40 -39
- 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: cadaf1215b2da0fd1ad43738ace4067eaaa34854163d46d2813cdbaed2c12b81
|
4
|
+
data.tar.gz: c12db9591acdec03bef9453eb28c02a476c732f2bf19e7dfe0c6f37f392ddd78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b9d0408cd7218d7191ea7b709df8806b29c8ca3a4d7fd5858111089b57154eb3b030cc3eab3ccd145aedd50493bf1349be1fb10ace2a0986761e976929334a7
|
7
|
+
data.tar.gz: 3d203c56ac70d4f8c50fd51fd115922782fa50f64a6be2d11453f74aa8818c373e36ecbfa84662b8831969537b7bc1fe99e161b9339e071132f99327108b29a7
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/kvx.rb
CHANGED
@@ -36,7 +36,7 @@ class Kvx
|
|
36
36
|
|
37
37
|
def initialize(x=nil, attributes: {}, debug: false)
|
38
38
|
|
39
|
-
@header =
|
39
|
+
@header = attributes.any?
|
40
40
|
@identifier = 'kvx'
|
41
41
|
@summary = {}
|
42
42
|
@ignore_blank_lines ||= false
|
@@ -76,12 +76,23 @@ class Kvx
|
|
76
76
|
FileX.write filename, self.to_s
|
77
77
|
end
|
78
78
|
|
79
|
-
|
79
|
+
# flattening is helpful when passing the Hash object to
|
80
|
+
# RecordX as a new record
|
81
|
+
#
|
82
|
+
def to_h(flatten: false)
|
80
83
|
|
81
84
|
if @summary.empty? then
|
85
|
+
|
82
86
|
deep_clone @body
|
87
|
+
|
83
88
|
else
|
84
|
-
|
89
|
+
|
90
|
+
if flatten then
|
91
|
+
@summary.merge @body
|
92
|
+
else
|
93
|
+
{summary: deep_clone(@summary), body: deep_clone(@body)}
|
94
|
+
end
|
95
|
+
|
85
96
|
end
|
86
97
|
|
87
98
|
end
|
@@ -104,13 +115,24 @@ class Kvx
|
|
104
115
|
end
|
105
116
|
|
106
117
|
summary = [:summary, {}, *summary]
|
107
|
-
|
118
|
+
|
119
|
+
# -- use the nested description Hash object if there are multiple lines
|
120
|
+
h = {}
|
121
|
+
|
122
|
+
@body.each do |key, value|
|
123
|
+
|
124
|
+
h[key] = value.is_a?(String) ? value : value[:description]
|
125
|
+
|
126
|
+
end
|
127
|
+
|
128
|
+
body = [:body, {}, *make_xml(h)]
|
108
129
|
[self.class.to_s.downcase, @attributes, '', summary, body]
|
109
130
|
|
110
131
|
end
|
111
132
|
|
133
|
+
puts 'a: ' + a.inspect if @debug
|
112
134
|
doc = Rexle.new a
|
113
|
-
doc.instructions = @instructions
|
135
|
+
doc.instructions = @instructions || []
|
114
136
|
doc
|
115
137
|
|
116
138
|
end
|
@@ -126,11 +148,34 @@ class Kvx
|
|
126
148
|
header = '<?' + @identifier
|
127
149
|
header += attr
|
128
150
|
header += "?>\n"
|
129
|
-
|
130
|
-
|
151
|
+
|
152
|
+
if @summary and @summary.any? then
|
153
|
+
header += scan_to_s @summary
|
154
|
+
header += "\n----------------------------------\n\n"
|
155
|
+
end
|
156
|
+
|
131
157
|
end
|
158
|
+
|
159
|
+
# -- use the nested description Hash object if there are multiple lines
|
160
|
+
h = {}
|
132
161
|
|
133
|
-
|
162
|
+
@body.each do |key, value|
|
163
|
+
|
164
|
+
h[key] = if value.is_a?(String) then
|
165
|
+
|
166
|
+
if value.lines.length < 2 then
|
167
|
+
value
|
168
|
+
else
|
169
|
+
"\n" + value.lines.map {|x| ' ' + x }.join
|
170
|
+
end
|
171
|
+
|
172
|
+
else
|
173
|
+
"\n" + value[:description].lines.map {|x| ' ' + x }.join
|
174
|
+
end
|
175
|
+
|
176
|
+
end
|
177
|
+
|
178
|
+
header + scan_to_s(h)
|
134
179
|
|
135
180
|
end
|
136
181
|
|
@@ -140,6 +185,13 @@ class Kvx
|
|
140
185
|
doc.xml(options)
|
141
186
|
|
142
187
|
end
|
188
|
+
|
189
|
+
# used by RecordX to update a KVX record
|
190
|
+
# id is unnecssary because there is only 1 record mapped to RecordX
|
191
|
+
#
|
192
|
+
def update(id=nil, hpair={})
|
193
|
+
@body.merge! hpair
|
194
|
+
end
|
143
195
|
|
144
196
|
private
|
145
197
|
|
@@ -240,7 +292,7 @@ class Kvx
|
|
240
292
|
@attributes.merge! attr
|
241
293
|
@header = true
|
242
294
|
body, summary = a.join.strip.split(/^----*$/).reverse
|
243
|
-
@summary = scan_to_h summary
|
295
|
+
@summary = scan_to_h summary if summary
|
244
296
|
|
245
297
|
body
|
246
298
|
else
|
@@ -273,8 +325,8 @@ class Kvx
|
|
273
325
|
def scan_to_h(txt)
|
274
326
|
|
275
327
|
puts ('inside scan_to_h').info if @debug
|
276
|
-
raw_a = LineTree.new(txt.gsub(/(^-*$)|(
|
277
|
-
|
328
|
+
raw_a = LineTree.new(txt.gsub(/(^-*$)|(^ *#.*)/,'').strip,
|
329
|
+
ignore_blank_lines: @ignore_blank_lines).to_a
|
278
330
|
puts ('raw_a: ' + raw_a.inspect).debug if @debug
|
279
331
|
|
280
332
|
# if there are any orphan lines which aren't nested underneath a
|
@@ -296,7 +348,7 @@ class Kvx
|
|
296
348
|
|
297
349
|
if line.join.length > 0 then
|
298
350
|
|
299
|
-
r2 = if line[0][0][/^[^:]
|
351
|
+
r2 = if line[0][0][/^[^:]+: /] then
|
300
352
|
|
301
353
|
padding = line[0].length < 2 ? "\n" : "\n "
|
302
354
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kvx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -11,72 +11,72 @@ cert_chain:
|
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
13
|
MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMjEwMjIwMjI0ODU5WhcN
|
15
|
+
MjIwMjIwMjI0ODU5WjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
|
16
|
+
cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQDEZUlA
|
17
|
+
5Xwb1PhCpUwcey7fBjLJHAHnBg9lFLAFNGWr1QDpH166qx7w9Q9ckPeFNMiH5ZFs
|
18
|
+
/D9GrO+BVU3Lz5/CaL3q5eB3L8+JC+VjNiJijvynBa2TeB2aenlRqdUqvJ/RGTu0
|
19
|
+
9v8tWq/Mn3batCRCpuLJJ25C49hyzYts2UWetRAqfuvukJY+BoPISYntAs3g2elo
|
20
|
+
Za/9sY69ezCvOmwyw+B8dGXjqINlZxJKfuR3xf87uR/4vBC9DI4EE7dS1pjsyDws
|
21
|
+
d3e9fBWBKIMaZVdshc9rAnP6ARhWMnxYUjjqUDJiqXz5137HmWSOGWGGrnX0pfg2
|
22
|
+
WPVI7jN39s6Gd2nNGOgaiwlNpcNS7IPYHGU2+mDJxWSKn+suMjendpi/WSTQlLG4
|
23
|
+
PEZBk+B6CEy6yOLU4x5GN3US7wbwLOl0ASSAhb4vAG81pGI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+
date: 2021-05-18 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: line-tree
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
|
-
- - ">="
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: 0.9.0
|
47
44
|
- - "~>"
|
48
45
|
- !ruby/object:Gem::Version
|
49
46
|
version: '0.9'
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 0.9.1
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
|
-
- - ">="
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version: 0.9.0
|
57
54
|
- - "~>"
|
58
55
|
- !ruby/object:Gem::Version
|
59
56
|
version: '0.9'
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 0.9.1
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
61
|
name: rxfhelper
|
62
62
|
requirement: !ruby/object:Gem::Requirement
|
63
63
|
requirements:
|
64
|
-
- - "~>"
|
65
|
-
- !ruby/object:Gem::Version
|
66
|
-
version: '0.9'
|
67
64
|
- - ">="
|
68
65
|
- !ruby/object:Gem::Version
|
69
|
-
version: 0.
|
66
|
+
version: 1.0.0
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '1.0'
|
70
70
|
type: :runtime
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- - "~>"
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
version: '0.9'
|
77
74
|
- - ">="
|
78
75
|
- !ruby/object:Gem::Version
|
79
|
-
version: 0.
|
76
|
+
version: 1.0.0
|
77
|
+
- - "~>"
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '1.0'
|
80
80
|
description:
|
81
81
|
email: james@jamesrobertson.eu
|
82
82
|
executables: []
|
@@ -103,7 +103,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
103
|
- !ruby/object:Gem::Version
|
104
104
|
version: '0'
|
105
105
|
requirements: []
|
106
|
-
|
106
|
+
rubyforge_project:
|
107
|
+
rubygems_version: 2.7.10
|
107
108
|
signing_key:
|
108
109
|
specification_version: 4
|
109
110
|
summary: Kvx (Keys, Values, and XML) makes it convenient to store and retrieve the
|
metadata.gz.sig
CHANGED
Binary file
|