dynarex 1.8.21 → 1.8.26
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/dynarex.rb +35 -9
- metadata +24 -24
- 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: e53d646e16a9dc5418563c918079a755131d13bcbb8a9f09378a83641e8e263f
|
4
|
+
data.tar.gz: edfd2bced3fec3b31f4ecffff0ec6b01b8c0605633e19ece62f3832e0cef014c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 291eaa36c95e263c1233bd27aae70893bf759738f16872c93da104a015c0b0557694c828aaa67e8b439d8324c5b3fcb76568b7671faa839f4006a8b38066a86b
|
7
|
+
data.tar.gz: 4f96e7fc8a576515f6261c2a7dfc4044ad64b0009cf4e92d1a6e5001ba512ce0b0c119076e2e7080d4e0789f2405168443ba290a72b41901d3b649631448780c
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/dynarex.rb
CHANGED
@@ -90,13 +90,14 @@ class Dynarex
|
|
90
90
|
def initialize(rawx=nil, username: nil, password: nil, schema: nil,
|
91
91
|
default_key: nil, json_out: true, debug: false,
|
92
92
|
delimiter: ' # ', autosave: false, order: 'ascending',
|
93
|
-
unique: false)
|
93
|
+
unique: false, filepath: nil)
|
94
94
|
|
95
95
|
|
96
96
|
puts 'inside Dynarex::initialize' if debug
|
97
97
|
@username, @password, @schema, @default_key, @json_out, @debug = \
|
98
98
|
username, password, schema, default_key, json_out, debug
|
99
99
|
@autosave, @unique = autosave, unique
|
100
|
+
@local_filepath = filepath
|
100
101
|
|
101
102
|
puts ('@debug: ' + @debug.inspect).debug if debug
|
102
103
|
@delimiter = delimiter
|
@@ -124,8 +125,11 @@ class Dynarex
|
|
124
125
|
end
|
125
126
|
|
126
127
|
def all()
|
128
|
+
|
129
|
+
refresh! if @dirty_flag
|
127
130
|
a = @doc.root.xpath("records/*").map {|x| recordx_to_record x}
|
128
131
|
DynarexRecordset.new(a, self)
|
132
|
+
|
129
133
|
end
|
130
134
|
|
131
135
|
def clone()
|
@@ -325,13 +329,28 @@ class Dynarex
|
|
325
329
|
|
326
330
|
end
|
327
331
|
|
328
|
-
|
332
|
+
|
333
|
+
# to_json: pretty is set to true because although the file size is larger,
|
334
|
+
# the file can be load slightly quicker
|
335
|
+
|
336
|
+
def to_json(pretty: true)
|
329
337
|
|
330
338
|
records = self.to_a
|
331
339
|
summary = self.summary.to_h
|
332
|
-
|
333
|
-
|
340
|
+
|
341
|
+
root_name = schema()[/^\w+/]
|
342
|
+
record_name = schema()[/(?<=\/)[^\(]+/]
|
343
|
+
|
344
|
+
h = {
|
345
|
+
root_name.to_sym =>
|
346
|
+
{
|
347
|
+
summary: @summary,
|
348
|
+
records: @records.map {|_, h| {record_name.to_sym => h} }
|
349
|
+
}
|
350
|
+
}
|
351
|
+
|
334
352
|
pretty ? JSON.pretty_generate(h) : h.to_json
|
353
|
+
|
335
354
|
end
|
336
355
|
|
337
356
|
def to_s(header: true, delimiter: @delimiter)
|
@@ -397,6 +416,7 @@ EOF
|
|
397
416
|
if @debug then
|
398
417
|
File.write '/tmp/foo.xsl', xsl_buffer
|
399
418
|
File.write '/tmp/foo.xml', @doc.xml
|
419
|
+
puts 'xsl_buffer: ' + xsl_buffer.inspect
|
400
420
|
end
|
401
421
|
|
402
422
|
out = Rexslt.new(xsl_buffer, @doc).to_s
|
@@ -413,6 +433,7 @@ EOF
|
|
413
433
|
xslt_format = a.join
|
414
434
|
|
415
435
|
xsl_buffer.sub!(/\[!regex_values\]/, xslt_format)
|
436
|
+
puts 'xsl_buffer: ' + xsl_buffer.inspect if @debug
|
416
437
|
|
417
438
|
out = Rexslt.new(xsl_buffer, @doc).to_s
|
418
439
|
|
@@ -474,6 +495,8 @@ EOF
|
|
474
495
|
|
475
496
|
end
|
476
497
|
|
498
|
+
return unless filepath
|
499
|
+
|
477
500
|
opt = {pretty: true}.merge options
|
478
501
|
|
479
502
|
@local_filepath = filepath || 'dx.xml'
|
@@ -653,6 +676,10 @@ EOF
|
|
653
676
|
@dirty_flag = true
|
654
677
|
end
|
655
678
|
|
679
|
+
def refresh!()
|
680
|
+
(load_records; rebuild_doc) if @dirty_flag == true
|
681
|
+
end
|
682
|
+
|
656
683
|
# used internally by to_rss()
|
657
684
|
#
|
658
685
|
def rss_xslt(opt={})
|
@@ -718,17 +745,16 @@ EOF
|
|
718
745
|
item.delete
|
719
746
|
|
720
747
|
pubdate = @xslt_schema[/pubDate:/]
|
721
|
-
xslif = Rexle.new("<xsl:if test='position()
|
748
|
+
xslif = Rexle.new("<xsl:if test='position() < #{h[:limit]}'/>").root
|
722
749
|
|
723
750
|
|
724
|
-
|
725
751
|
if pubdate.nil? then
|
726
752
|
pubdate2 = Rexle.new("<pubDate><xsl:value-of select='pubDate'></xsl:value-of></pubDate>").root
|
727
753
|
new_item.add pubdate2
|
728
754
|
end
|
729
755
|
|
730
756
|
xslif.add new_item
|
731
|
-
e2.add xslif
|
757
|
+
e2.add xslif
|
732
758
|
xslt = doc.xml
|
733
759
|
|
734
760
|
xslt
|
@@ -822,7 +848,7 @@ EOF
|
|
822
848
|
|
823
849
|
puts 'inside hash_create' if @debug
|
824
850
|
record = make_record(raw_params, id, attr: attr)
|
825
|
-
puts 'record: ' + record.inspect
|
851
|
+
puts 'record: ' + record.inspect if @debug
|
826
852
|
method_name = @order == 'ascending' ? :add : :prepend
|
827
853
|
@doc.root.element('records').method(method_name).call record
|
828
854
|
|
@@ -1059,7 +1085,7 @@ EOF
|
|
1059
1085
|
|
1060
1086
|
raw_lines.shift while raw_lines.first.strip.empty?
|
1061
1087
|
|
1062
|
-
lines = case raw_lines.first.
|
1088
|
+
lines = case raw_lines.first.rstrip
|
1063
1089
|
|
1064
1090
|
when '---'
|
1065
1091
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dynarex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.26
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
3m/dAMW7lgXujFuiEWdIWXXpu+uf7b2FKdTmZ1gzaYUi8H0j0VraXT1jhzQYZH/1
|
36
36
|
zCi9HdW7AMP5hS692rfwJuEY
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date:
|
38
|
+
date: 2020-07-17 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: dynarex-import
|
@@ -61,42 +61,42 @@ dependencies:
|
|
61
61
|
name: rexle-builder
|
62
62
|
requirement: !ruby/object:Gem::Requirement
|
63
63
|
requirements:
|
64
|
-
- - ">="
|
65
|
-
- !ruby/object:Gem::Version
|
66
|
-
version: 0.6.0
|
67
64
|
- - "~>"
|
68
65
|
- !ruby/object:Gem::Version
|
69
|
-
version: '0
|
66
|
+
version: '1.0'
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 1.0.2
|
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.6.0
|
77
74
|
- - "~>"
|
78
75
|
- !ruby/object:Gem::Version
|
79
|
-
version: '0
|
76
|
+
version: '1.0'
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: 1.0.2
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: rexslt
|
82
82
|
requirement: !ruby/object:Gem::Requirement
|
83
83
|
requirements:
|
84
|
-
- - "~>"
|
85
|
-
- !ruby/object:Gem::Version
|
86
|
-
version: '0.6'
|
87
84
|
- - ">="
|
88
85
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.
|
86
|
+
version: 0.7.0
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.7'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0.6'
|
97
94
|
- - ">="
|
98
95
|
- !ruby/object:Gem::Version
|
99
|
-
version: 0.
|
96
|
+
version: 0.7.0
|
97
|
+
- - "~>"
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0.7'
|
100
100
|
- !ruby/object:Gem::Dependency
|
101
101
|
name: dynarex-xslt
|
102
102
|
requirement: !ruby/object:Gem::Requirement
|
@@ -126,7 +126,7 @@ dependencies:
|
|
126
126
|
version: '0.5'
|
127
127
|
- - ">="
|
128
128
|
- !ruby/object:Gem::Version
|
129
|
-
version: 0.5.
|
129
|
+
version: 0.5.5
|
130
130
|
type: :runtime
|
131
131
|
prerelease: false
|
132
132
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -136,7 +136,7 @@ dependencies:
|
|
136
136
|
version: '0.5'
|
137
137
|
- - ">="
|
138
138
|
- !ruby/object:Gem::Version
|
139
|
-
version: 0.5.
|
139
|
+
version: 0.5.5
|
140
140
|
- !ruby/object:Gem::Dependency
|
141
141
|
name: rxraw-lineparser
|
142
142
|
requirement: !ruby/object:Gem::Requirement
|
@@ -203,20 +203,20 @@ dependencies:
|
|
203
203
|
requirements:
|
204
204
|
- - "~>"
|
205
205
|
- !ruby/object:Gem::Version
|
206
|
-
version: '0.
|
206
|
+
version: '0.9'
|
207
207
|
- - ">="
|
208
208
|
- !ruby/object:Gem::Version
|
209
|
-
version: 0.
|
209
|
+
version: 0.9.1
|
210
210
|
type: :runtime
|
211
211
|
prerelease: false
|
212
212
|
version_requirements: !ruby/object:Gem::Requirement
|
213
213
|
requirements:
|
214
214
|
- - "~>"
|
215
215
|
- !ruby/object:Gem::Version
|
216
|
-
version: '0.
|
216
|
+
version: '0.9'
|
217
217
|
- - ">="
|
218
218
|
- !ruby/object:Gem::Version
|
219
|
-
version: 0.
|
219
|
+
version: 0.9.1
|
220
220
|
description:
|
221
221
|
email: james@jamesrobertson.eu
|
222
222
|
executables: []
|
metadata.gz.sig
CHANGED
Binary file
|