kvx 0.7.2 → 0.9.1
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 +61 -12
- metadata +39 -34
- 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: 682f52238fb054d8d2eb1f53d25782d1b5cbdbce7da2431a3d1a107e6a8518a9
|
4
|
+
data.tar.gz: 1579826620b98ad2a70e1924b5220321e03cf9427f712eb3ce4b4719de5b9af3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42807b79e8a251eaaa4c317b50863d0a58903d5777fcf7bd4148085911235c3f98a579cd6f8d2f55b67cb86d98b5771bcaedaf39be33ecf8375501fe046abfd6
|
7
|
+
data.tar.gz: 3157e3be4a3fe98219b13b38b94427a84885a379366f44b7cbad928675fc0c44d6935a94292e5ba38c11e3ef3bb43821778da0dbcd6243a508eaca3bdf69d284
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/kvx.rb
CHANGED
@@ -6,6 +6,20 @@ require 'line-tree'
|
|
6
6
|
require 'rxfhelper'
|
7
7
|
require 'rexle-builder'
|
8
8
|
|
9
|
+
module RegGem
|
10
|
+
|
11
|
+
def self.register()
|
12
|
+
'
|
13
|
+
hkey_gems
|
14
|
+
doctype
|
15
|
+
kvx
|
16
|
+
require kvx
|
17
|
+
class Kvx
|
18
|
+
media_type kvx
|
19
|
+
'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
9
23
|
###
|
10
24
|
# Kvx does the following:
|
11
25
|
#
|
@@ -15,11 +29,12 @@ require 'rexle-builder'
|
|
15
29
|
|
16
30
|
class Kvx
|
17
31
|
include RXFHelperModule
|
32
|
+
using ColouredText
|
18
33
|
|
19
34
|
attr_accessor :attributes, :summary
|
20
35
|
attr_reader :to_h
|
21
36
|
|
22
|
-
def initialize(x, attributes: {}, debug: false)
|
37
|
+
def initialize(x=nil, attributes: {}, debug: false)
|
23
38
|
|
24
39
|
@header = false
|
25
40
|
@identifier = 'kvx'
|
@@ -36,15 +51,26 @@ class Kvx
|
|
36
51
|
:"rexle::element::value" => :parse_string
|
37
52
|
}
|
38
53
|
|
39
|
-
|
54
|
+
if x then
|
55
|
+
|
56
|
+
sym = h[x.class.to_s.downcase.to_sym]
|
57
|
+
puts 'sym: ' + sym.inspect if @debug
|
58
|
+
@body = method(sym).call x
|
59
|
+
methodize(@body)
|
60
|
+
end
|
40
61
|
|
41
62
|
end
|
63
|
+
|
64
|
+
def import(s)
|
65
|
+
@body = parse_string(s)
|
66
|
+
methodize(@body)
|
67
|
+
end
|
42
68
|
|
43
69
|
def item()
|
44
70
|
@body
|
45
71
|
end
|
46
72
|
|
47
|
-
alias body item
|
73
|
+
alias body item
|
48
74
|
|
49
75
|
def save(filename)
|
50
76
|
FileX.write filename, self.to_s
|
@@ -83,7 +109,9 @@ class Kvx
|
|
83
109
|
|
84
110
|
end
|
85
111
|
|
86
|
-
Rexle.new a
|
112
|
+
doc = Rexle.new a
|
113
|
+
doc.instructions = @instructions
|
114
|
+
doc
|
87
115
|
|
88
116
|
end
|
89
117
|
|
@@ -91,7 +119,7 @@ class Kvx
|
|
91
119
|
|
92
120
|
header = ''
|
93
121
|
|
94
|
-
if @header or @summary.any? then
|
122
|
+
if @header or (@summary and @summary.any?) then
|
95
123
|
|
96
124
|
attr = @attributes ? ' ' + @attributes\
|
97
125
|
.map {|x| "%s='%s'" % x }.join(' ') : ''
|
@@ -162,14 +190,32 @@ class Kvx
|
|
162
190
|
end
|
163
191
|
|
164
192
|
def make_xml(h)
|
165
|
-
|
193
|
+
|
194
|
+
puts 'inside make_xml: ' + h.inspect if @debug
|
195
|
+
RexleBuilder.new(h, debug: false).to_a[3..-1]
|
166
196
|
end
|
167
197
|
|
168
198
|
def parse_string(s)
|
169
199
|
|
170
200
|
buffer, type = RXFHelper.read(s)
|
171
|
-
puts 'buffer: ' + buffer.inspect if @debug
|
172
|
-
|
201
|
+
puts ('buffer: ' + buffer.inspect).debug if @debug
|
202
|
+
|
203
|
+
if buffer.lstrip =~ /^<\?xml/ then
|
204
|
+
doc = Rexle.new(buffer)
|
205
|
+
@instructions = doc.instructions
|
206
|
+
puts '@instructions: ' + @instructions.inspect if @debug
|
207
|
+
xml_to_h(doc.root)
|
208
|
+
else
|
209
|
+
parse_to_h(buffer)
|
210
|
+
end
|
211
|
+
|
212
|
+
end
|
213
|
+
|
214
|
+
def methodize(h)
|
215
|
+
|
216
|
+
h.each do |k,v|
|
217
|
+
define_singleton_method(k){v} unless self.methods.include? k
|
218
|
+
end
|
173
219
|
|
174
220
|
end
|
175
221
|
|
@@ -226,10 +272,10 @@ class Kvx
|
|
226
272
|
|
227
273
|
def scan_to_h(txt)
|
228
274
|
|
229
|
-
puts 'inside scan_to_h' if @debug
|
275
|
+
puts ('inside scan_to_h').info if @debug
|
230
276
|
raw_a = LineTree.new(txt.gsub(/(^-*$)|(#.*)/,'').strip,
|
231
277
|
ignore_blank_lines: @ignore_blank_lines).to_a
|
232
|
-
puts 'raw_a: ' + raw_a.inspect if @debug
|
278
|
+
puts ('raw_a: ' + raw_a.inspect).debug if @debug
|
233
279
|
|
234
280
|
# if there are any orphan lines which aren't nested underneath a
|
235
281
|
# label, they will be fixed using the following statement
|
@@ -246,7 +292,7 @@ class Kvx
|
|
246
292
|
@body = a.inject({}) do |r, line|
|
247
293
|
|
248
294
|
s = line.shift
|
249
|
-
puts 's: ' + s.inspect
|
295
|
+
puts ('s: ' + s.inspect).debug if @debug
|
250
296
|
|
251
297
|
if line.join.length > 0 then
|
252
298
|
|
@@ -289,7 +335,7 @@ class Kvx
|
|
289
335
|
|
290
336
|
end
|
291
337
|
|
292
|
-
puts '@body: ' + @body.inspect
|
338
|
+
puts ('@body: ' + @body.inspect).debug if @debug
|
293
339
|
@body
|
294
340
|
|
295
341
|
end
|
@@ -309,6 +355,9 @@ class Kvx
|
|
309
355
|
|
310
356
|
def xml_to_h(node)
|
311
357
|
|
358
|
+
puts 'node: ' + node.xml.inspect if @debug
|
359
|
+
@attributes = node.attributes.to_h
|
360
|
+
|
312
361
|
summary = node.element('summary')
|
313
362
|
|
314
363
|
if summary then
|
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.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,27 +10,32 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
13
|
+
MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMTkwODE1MTY1NjM2WhcN
|
15
|
+
MjAwODE0MTY1NjM2WjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
|
16
|
+
cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQC6K+Kz
|
17
|
+
ybTob3TbRSTALvfrmAyCyc05LGgxBgTA/6ykxggtrw3V70p+6OFX4g9ReH2VIgKD
|
18
|
+
3cTf5Drs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33
|
+
KzKMbj6nwMsGquFqseU2SwmpvyyP/hhqYYgV/6gHf8ZrSM0YH+2ESruR/fxla6yj
|
34
|
+
FpNMxFEOQ/xVXHve//AgIZBQlUDG55q0lhWZ2c0S/z12iD4cPFNW4PJ4wJDji6O4
|
35
|
+
KUxK0Cu0STvwoV6DE5WnnZSur8LrUOi7l9Nk6viqnO36QEwToCPb1F2eqzGV+jI1
|
36
|
+
WeCuyBYkl+4fwV5cb7w7t9YY
|
32
37
|
-----END CERTIFICATE-----
|
33
|
-
date:
|
38
|
+
date: 2020-06-11 00:00:00.000000000 Z
|
34
39
|
dependencies:
|
35
40
|
- !ruby/object:Gem::Dependency
|
36
41
|
name: line-tree
|
@@ -38,40 +43,40 @@ dependencies:
|
|
38
43
|
requirements:
|
39
44
|
- - "~>"
|
40
45
|
- !ruby/object:Gem::Version
|
41
|
-
version: '0.
|
46
|
+
version: '0.9'
|
42
47
|
- - ">="
|
43
48
|
- !ruby/object:Gem::Version
|
44
|
-
version: 0.
|
49
|
+
version: 0.9.1
|
45
50
|
type: :runtime
|
46
51
|
prerelease: false
|
47
52
|
version_requirements: !ruby/object:Gem::Requirement
|
48
53
|
requirements:
|
49
54
|
- - "~>"
|
50
55
|
- !ruby/object:Gem::Version
|
51
|
-
version: '0.
|
56
|
+
version: '0.9'
|
52
57
|
- - ">="
|
53
58
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
59
|
+
version: 0.9.1
|
55
60
|
- !ruby/object:Gem::Dependency
|
56
61
|
name: rxfhelper
|
57
62
|
requirement: !ruby/object:Gem::Requirement
|
58
63
|
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0.6'
|
62
64
|
- - ">="
|
63
65
|
- !ruby/object:Gem::Version
|
64
|
-
version: 0.
|
66
|
+
version: 1.0.0
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '1.0'
|
65
70
|
type: :runtime
|
66
71
|
prerelease: false
|
67
72
|
version_requirements: !ruby/object:Gem::Requirement
|
68
73
|
requirements:
|
69
|
-
- - "~>"
|
70
|
-
- !ruby/object:Gem::Version
|
71
|
-
version: '0.6'
|
72
74
|
- - ">="
|
73
75
|
- !ruby/object:Gem::Version
|
74
|
-
version: 0.
|
76
|
+
version: 1.0.0
|
77
|
+
- - "~>"
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '1.0'
|
75
80
|
description:
|
76
81
|
email: james@jamesrobertson.eu
|
77
82
|
executables: []
|
@@ -99,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
104
|
version: '0'
|
100
105
|
requirements: []
|
101
106
|
rubyforge_project:
|
102
|
-
rubygems_version: 2.7.
|
107
|
+
rubygems_version: 2.7.10
|
103
108
|
signing_key:
|
104
109
|
specification_version: 4
|
105
110
|
summary: Kvx (Keys, Values, and XML) makes it convenient to store and retrieve the
|
metadata.gz.sig
CHANGED
Binary file
|