kvx 0.9.4 → 0.9.9
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 +42 -11
- metadata +9 -10
- 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: 15f341e0536edd706c0b9fcaef3f72644aa71ddada69de76d4a79d223b9b5ec6
|
4
|
+
data.tar.gz: 7bd3ba8db13f0dfa1369d4694fc4ef5d6e7159b9494ef1cb7c792b6a2a1c9d0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a57d322f8186ea30dbe81b657192dee6729d6dce7026f8ca96fef38199dcff3bf7158c122aa9a8181759360b50d4813a5a62a5cdb81767e4f81566a0ae495f0f
|
7
|
+
data.tar.gz: 7058b1386cd2045b6871848c8ae140ebe498cc50e7c8c356a5f6d003f3e74d9334533d727ec595cfebfe769c673c4da5cd5fda555d89ae2147918b5777bbd53e
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/kvx.rb
CHANGED
@@ -244,7 +244,10 @@ class Kvx
|
|
244
244
|
def make_xml(h)
|
245
245
|
|
246
246
|
puts 'inside make_xml: ' + h.inspect if @debug
|
247
|
-
|
247
|
+
h2 = h.clone
|
248
|
+
h2.each {|key,value| value.delete :items if value.is_a?(Hash) }
|
249
|
+
|
250
|
+
RexleBuilder.new(h2, debug: false).to_a[3..-1]
|
248
251
|
end
|
249
252
|
|
250
253
|
def parse_string(s)
|
@@ -323,22 +326,47 @@ class Kvx
|
|
323
326
|
|
324
327
|
|
325
328
|
def scan_to_h(txt)
|
329
|
+
|
330
|
+
txt.gsub!(/^\w+:(?=$)/,'\0 ')
|
331
|
+
puts 'txt:' + txt.inspect if @debug
|
332
|
+
|
333
|
+
# auto indent any multiline values which aren't already indented
|
334
|
+
|
335
|
+
indent = ''
|
336
|
+
|
337
|
+
lines = txt.gsub(/^-+$/m,'').lines.map do |line|
|
326
338
|
|
339
|
+
if not line[/^ *[^:]+:|^ +/] then
|
340
|
+
indent + ' ' + line
|
341
|
+
else
|
342
|
+
indent = line[/^ +/] || ''
|
343
|
+
line
|
344
|
+
end
|
345
|
+
|
346
|
+
end
|
347
|
+
puts ('lines: ' + lines.inspect).debug if @debug
|
348
|
+
|
327
349
|
puts ('inside scan_to_h').info if @debug
|
328
|
-
raw_a = LineTree.new(
|
329
|
-
|
350
|
+
raw_a = LineTree.new(lines.join.gsub(/(^-*$)|(?<=\S) +#.*/,'').strip,
|
351
|
+
ignore_blank_lines: @ignore_blank_lines).to_a
|
330
352
|
puts ('raw_a: ' + raw_a.inspect).debug if @debug
|
331
353
|
|
332
354
|
# if there are any orphan lines which aren't nested underneath a
|
333
355
|
# label, they will be fixed using the following statement
|
334
356
|
|
335
|
-
a = raw_a.chunk {|x| x[0][/^[^:]
|
357
|
+
a = raw_a.chunk {|x| x[0][/^[^:]+:/]}.inject([]) do |r,y|
|
358
|
+
|
359
|
+
puts 'r: ' + r.inspect if @debug
|
360
|
+
|
336
361
|
if r.last and !y.first[/[^:]+:/] then
|
337
362
|
r.last << y.last[-1]
|
338
363
|
else
|
364
|
+
puts 'y: ' + y.inspect if @debug
|
339
365
|
r << y.last[-1]
|
340
366
|
end
|
367
|
+
|
341
368
|
r
|
369
|
+
|
342
370
|
end
|
343
371
|
|
344
372
|
@body = a.inject({}) do |r, line|
|
@@ -346,13 +374,16 @@ class Kvx
|
|
346
374
|
s = line.shift
|
347
375
|
puts ('s: ' + s.inspect).debug if @debug
|
348
376
|
|
349
|
-
if line.join.length > 0 then
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
377
|
+
if line.join.length > 0 then
|
378
|
+
|
379
|
+
puts 'line: ' + line.inspect if @debug
|
380
|
+
|
381
|
+
padding = line[0].length < 2 ? "\n" : "\n "
|
382
|
+
s10 = line.map{|x| x.join(padding)}.join("\n")
|
383
|
+
|
384
|
+
r2 = if s10[/^[^:]+:[\n ]/] then
|
354
385
|
|
355
|
-
scan_to_h(
|
386
|
+
scan_to_h(s10)
|
356
387
|
|
357
388
|
else
|
358
389
|
|
@@ -378,7 +409,7 @@ class Kvx
|
|
378
409
|
|
379
410
|
else
|
380
411
|
|
381
|
-
value, name = s.split(
|
412
|
+
value, name = s.split(/: */,2).reverse
|
382
413
|
name ||= 'description'
|
383
414
|
v = value =~ /^\{\s*\}$/ ? {} : value.to_s
|
384
415
|
|
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.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
m/+jxdgFjKKGxeZqunu9cp5ca9wSjjtKh/VA/3xZtPwokCa7vCMB+ZxUP0jvd++u
|
36
36
|
OTXy8k/zqddw/VfD/It1UUK4
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2021-05
|
38
|
+
date: 2021-06-05 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: line-tree
|
@@ -61,22 +61,22 @@ dependencies:
|
|
61
61
|
name: rxfhelper
|
62
62
|
requirement: !ruby/object:Gem::Requirement
|
63
63
|
requirements:
|
64
|
-
- - ">="
|
65
|
-
- !ruby/object:Gem::Version
|
66
|
-
version: 1.0.0
|
67
64
|
- - "~>"
|
68
65
|
- !ruby/object:Gem::Version
|
69
66
|
version: '1.0'
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 1.0.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: 1.0.0
|
77
74
|
- - "~>"
|
78
75
|
- !ruby/object:Gem::Version
|
79
76
|
version: '1.0'
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: 1.0.0
|
80
80
|
description:
|
81
81
|
email: james@jamesrobertson.eu
|
82
82
|
executables: []
|
@@ -103,8 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
103
|
- !ruby/object:Gem::Version
|
104
104
|
version: '0'
|
105
105
|
requirements: []
|
106
|
-
|
107
|
-
rubygems_version: 2.7.10
|
106
|
+
rubygems_version: 3.1.2
|
108
107
|
signing_key:
|
109
108
|
specification_version: 4
|
110
109
|
summary: Kvx (Keys, Values, and XML) makes it convenient to store and retrieve the
|
metadata.gz.sig
CHANGED
Binary file
|