kvx 0.9.5 → 0.9.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/kvx.rb +30 -4
- metadata +3 -4
- 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: 9ddaef947e49b210dbee31fcf56ec84e3644681c6a790c9ec80cb9fe314cd9d8
|
4
|
+
data.tar.gz: 56fae3981651c158701eb34023477125fbe7dd0ee8421d49d0e15174f550aae4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd452778a00be2a43d078b61ffdbb2616c1b631a0a1806c6027453c739b755ac90c7cd7e804ee6fe0839dae01d083d02abbffb7900e54fa6b7ba6159abee3248
|
7
|
+
data.tar.gz: 27c99e9368bc2dfd7cd49527eed157a31a9e2a2bd3d8caaf357fb12c1c5ccf898dc8913a963fdb2594eacf660054403302bc9425b54dfc46e06b588565ed9dd7
|
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,9 +326,27 @@ 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|
|
338
|
+
|
339
|
+
if not line[/^ *\w+:|^ +/] then
|
340
|
+
indent + ' ' + line
|
341
|
+
else
|
342
|
+
indent = line[/^ +/] || ''
|
343
|
+
line
|
344
|
+
end
|
345
|
+
|
346
|
+
end
|
326
347
|
|
327
348
|
puts ('inside scan_to_h').info if @debug
|
328
|
-
raw_a = LineTree.new(
|
349
|
+
raw_a = LineTree.new(lines.join.gsub(/(^-*$)|(^ *#.*)/,'').strip,
|
329
350
|
ignore_blank_lines: @ignore_blank_lines).to_a
|
330
351
|
puts ('raw_a: ' + raw_a.inspect).debug if @debug
|
331
352
|
|
@@ -333,12 +354,17 @@ class Kvx
|
|
333
354
|
# label, they will be fixed using the following statement
|
334
355
|
|
335
356
|
a = raw_a.chunk {|x| x[0][/^[^:]+:|.*/]}.inject([]) do |r,y|
|
357
|
+
|
358
|
+
puts 'r: ' + r.inspect if @debug
|
359
|
+
|
336
360
|
if r.last and !y.first[/[^:]+:/] then
|
337
361
|
r.last << y.last[-1]
|
338
362
|
else
|
339
363
|
r << y.last[-1]
|
340
364
|
end
|
365
|
+
|
341
366
|
r
|
367
|
+
|
342
368
|
end
|
343
369
|
|
344
370
|
@body = a.inject({}) do |r, line|
|
@@ -348,7 +374,7 @@ class Kvx
|
|
348
374
|
|
349
375
|
if line.join.length > 0 then
|
350
376
|
|
351
|
-
r2 = if line[0][0][/^[^:]
|
377
|
+
r2 = if line[0][0][/^[^:]+:/] then
|
352
378
|
|
353
379
|
padding = line[0].length < 2 ? "\n" : "\n "
|
354
380
|
|
@@ -378,7 +404,7 @@ class Kvx
|
|
378
404
|
|
379
405
|
else
|
380
406
|
|
381
|
-
value, name = s.split(
|
407
|
+
value, name = s.split(/: */,2).reverse
|
382
408
|
name ||= 'description'
|
383
409
|
v = value =~ /^\{\s*\}$/ ? {} : value.to_s
|
384
410
|
|
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.6
|
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-05-19 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: line-tree
|
@@ -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.0.3
|
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
|