dynarex 1.7.5 → 1.7.6
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 +3 -1
- data.tar.gz.sig +0 -0
- data/lib/dynarex.rb +23 -10
- metadata +7 -7
- metadata.gz.sig +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bc90e7f9765e7690636c7387cdab80667656728
|
4
|
+
data.tar.gz: 4705b196cb65bb198c2cfb7c5264f31873aa18e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5eb725ed18a6dbc69dfe8e9903cd6d4781a760d8a6c90bac4a21bb752cc20f5fb5231bc71a800405f2d02bd750f3e84e11818eb125a2aa3e0a6c029068685dfc
|
7
|
+
data.tar.gz: 209046c0146edacae7bae1b6dfceda515ca2c91eb74c08f62c561bc7ed7a157a75d2f5fae811c88eb7cb56d71023913bb4341569fa931795b33d8f14ed0c9fea
|
checksums.yaml.gz.sig
CHANGED
@@ -1 +1,3 @@
|
|
1
|
-
|
1
|
+
5ص]�
|
2
|
+
d��u$z����y�d�m��6�x�NJ�N�r�b�H��;�A��쏹)bD)����H��X��
|
3
|
+
B0�\}��U�sDk�W���9J���T4�m��C���t
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/dynarex.rb
CHANGED
@@ -26,7 +26,7 @@ end
|
|
26
26
|
class Dynarex
|
27
27
|
|
28
28
|
attr_accessor :format_mask, :delimiter, :xslt_schema, :schema, :linked,
|
29
|
-
:order, :type, :limit, :xslt
|
29
|
+
:order, :type, :limit, :xslt, :json_out
|
30
30
|
|
31
31
|
|
32
32
|
#Create a new dynarex document from 1 of the following options:
|
@@ -37,17 +37,20 @@ class Dynarex
|
|
37
37
|
#* an XML string
|
38
38
|
# Dynarex.new '<contacts><summary><schema>contacts/contact(name,age,dob)</schema></summary><records/></contacts>'
|
39
39
|
|
40
|
-
def initialize(rawx=nil,
|
40
|
+
def initialize(rawx=nil, username: nil, password: nil, schema: nil,
|
41
|
+
default_key: nil, json_out: true)
|
41
42
|
|
42
43
|
#File.write '/tmp/d.log',''
|
43
|
-
|
44
|
+
@log = Logger.new File.expand_path('~/dx.log'),'daily'
|
44
45
|
#@logger.debug 'inside intialize'
|
45
|
-
@
|
46
|
+
@username, @password, @schema, @default_key, @json_out = username,
|
47
|
+
password, schema, default_key, json_out
|
46
48
|
@delimiter = ''
|
47
49
|
@spaces_delimited = false
|
48
50
|
@order = 'ascending'
|
49
51
|
@limit = nil
|
50
52
|
@records, @flat_records = [], []
|
53
|
+
@json_out = json_out
|
51
54
|
|
52
55
|
openx(rawx.clone) if rawx
|
53
56
|
#@logger.debug 'doc: ' + @doc.xml.inspect
|
@@ -221,6 +224,8 @@ class Dynarex
|
|
221
224
|
end
|
222
225
|
|
223
226
|
def to_s
|
227
|
+
|
228
|
+
@log.debug 'inside to_s'
|
224
229
|
|
225
230
|
xsl_buffer =<<EOF
|
226
231
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
@@ -246,7 +251,9 @@ EOF
|
|
246
251
|
sumry = summary_fields.map {|x| x.strip!; x + ': ' + \
|
247
252
|
self.summary[x.to_sym]}.join("\n") + "\n"
|
248
253
|
end
|
249
|
-
|
254
|
+
|
255
|
+
@log.debug 'before @raw_header'
|
256
|
+
|
250
257
|
if @raw_header then
|
251
258
|
declaration = @raw_header
|
252
259
|
else
|
@@ -266,6 +273,8 @@ EOF
|
|
266
273
|
end
|
267
274
|
|
268
275
|
header = declaration + sumry
|
276
|
+
|
277
|
+
@log.debug 'after header'
|
269
278
|
|
270
279
|
if self.summary[:rawdoc_type] == 'rowx' then
|
271
280
|
a = self.fields.map do |field|
|
@@ -304,15 +313,18 @@ EOF
|
|
304
313
|
header + tfo.display
|
305
314
|
|
306
315
|
else
|
307
|
-
|
316
|
+
@log.debug 'inside else'
|
308
317
|
format_mask = self.format_mask
|
309
318
|
format_mask.gsub!(/\[[^!\]]+\]/) {|x| x[1] }
|
310
319
|
xslt_format = format_mask.gsub(/\s(?=\[!\w+\])/,'<xsl:text> </xsl:text>')
|
311
320
|
.gsub(/\[!(\w+)\]/, '<xsl:value-of select="\1"/>')
|
312
321
|
|
313
322
|
xsl_buffer.sub!(/\[!regex_values\]/, xslt_format)
|
314
|
-
|
323
|
+
@log.debug 'before Rexslt'
|
324
|
+
File.write 'test.xsl', xsl_buffer
|
325
|
+
File.write 'test.xml', @doc.xml
|
315
326
|
out = Rexslt.new(xsl_buffer, @doc).to_s
|
327
|
+
@log.debug 'after Rexslt'
|
316
328
|
header + "\n" + out
|
317
329
|
end
|
318
330
|
|
@@ -350,6 +362,7 @@ EOF
|
|
350
362
|
xml = display_xml(opt)
|
351
363
|
buffer = block_given? ? yield(xml) : xml
|
352
364
|
File.write filepath, buffer
|
365
|
+
File.write(filepath.sub(/\.xml$/,'.json'), self.to_json) if @json_out
|
353
366
|
end
|
354
367
|
|
355
368
|
#Parses 1 or more lines of text to create or update existing records.
|
@@ -1031,14 +1044,14 @@ EOF
|
|
1031
1044
|
dynarex_new(s)
|
1032
1045
|
|
1033
1046
|
elsif s[/^https?:\/\//] then # url
|
1034
|
-
buffer, _ = RXFHelper.read s, {username: @
|
1047
|
+
buffer, _ = RXFHelper.read s, {username: @username, password: @password}
|
1035
1048
|
else # local file
|
1036
1049
|
@local_filepath = s
|
1037
1050
|
|
1038
1051
|
if File.exists? s then
|
1039
1052
|
buffer = File.read s
|
1040
|
-
elsif @
|
1041
|
-
dynarex_new @
|
1053
|
+
elsif @schema
|
1054
|
+
dynarex_new @schema, default_key: @default_key
|
1042
1055
|
else
|
1043
1056
|
raise DynarexException, 'file not found: ' + s
|
1044
1057
|
end
|
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.7.
|
4
|
+
version: 1.7.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
nP4bxzo6o8Qw40KPcv/n3Vcx8tV8hUOOe4XkImYbeWst9hbbHfbg8daipgkn9NEu
|
32
32
|
YXuVi+EfN14P6g==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2016-
|
34
|
+
date: 2016-07-08 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: dynarex-import
|
@@ -199,20 +199,20 @@ dependencies:
|
|
199
199
|
requirements:
|
200
200
|
- - "~>"
|
201
201
|
- !ruby/object:Gem::Version
|
202
|
-
version: '0.
|
202
|
+
version: '0.6'
|
203
203
|
- - ">="
|
204
204
|
- !ruby/object:Gem::Version
|
205
|
-
version: 0.
|
205
|
+
version: 0.6.0
|
206
206
|
type: :runtime
|
207
207
|
prerelease: false
|
208
208
|
version_requirements: !ruby/object:Gem::Requirement
|
209
209
|
requirements:
|
210
210
|
- - "~>"
|
211
211
|
- !ruby/object:Gem::Version
|
212
|
-
version: '0.
|
212
|
+
version: '0.6'
|
213
213
|
- - ">="
|
214
214
|
- !ruby/object:Gem::Version
|
215
|
-
version: 0.
|
215
|
+
version: 0.6.0
|
216
216
|
description:
|
217
217
|
email: james@r0bertson.co.uk
|
218
218
|
executables: []
|
@@ -243,6 +243,6 @@ rubyforge_project:
|
|
243
243
|
rubygems_version: 2.5.1
|
244
244
|
signing_key:
|
245
245
|
specification_version: 4
|
246
|
-
summary: The Dynarex gem
|
246
|
+
summary: The Dynarex gem creates, reads, updates or delete rows of Dynarex flavoured
|
247
247
|
XML records.
|
248
248
|
test_files: []
|
metadata.gz.sig
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
�#��fJ/]��_�����[����+J���i/�M��jt2�Fox���Z�Y �Q~s*�U�����{�Q�H�0��
|
2
|
+
�뿵F%Q��w�� {����b�a�H���������߄D7�����Ԣ��igٶ��^�QX�
|