dynarex 1.7.2 → 1.7.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +2 -2
  4. data/lib/dynarex.rb +31 -19
  5. metadata +14 -14
  6. metadata.gz.sig +2 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 497e98c0cc9e83321ab14a3962246040ecd26a96
4
- data.tar.gz: aebacc2dd1ff7fffcfd0f2b65c0fef193ab728f1
3
+ metadata.gz: 4df04d217ba37aaec81bd1956077d25d25b1b0bb
4
+ data.tar.gz: 0763d0b88a44e339644c14d6e496f8edd66ae50b
5
5
  SHA512:
6
- metadata.gz: 18feda8c47b940955190d4c03705e93cfeb068fa0eec3e79b97320777cb8842f0d994d5f14f4147467b8dac310d5aa1b0f9f5bba6fa24ef15a38b798620fdb44
7
- data.tar.gz: c7058361ee9ab63498f9d0c7d589dc4a5896a2b6a67d6744a4a46576f22df7fb720952fd05235f99a6e3a53c22728b4dd4d33abf2b4572b43b11085490e815ee
6
+ metadata.gz: 098f64a26a6bdf9079248ba00e4c9c343ddbdce246b09f805082dc3bb0dbcd07b35839ac7c868b213ee9c1786830ef0fd29412d748a87f4f661968095c231f87
7
+ data.tar.gz: 92fb1437b4c934ad89a807504a9994b6a92fcf11c3838caa95133a3360cb260964c23ada90b95f792d1a5337875ad6588f618cf82a1f3623cc46c8b7a310dc25
Binary file
data.tar.gz.sig CHANGED
@@ -1,2 +1,2 @@
1
- {_M-reE����1w�Gr������q�]�F;v��'����C��{��0$uk�0���&�4p��z�*`�� �ݤS�(V|���J��k�"ٳj�\��ns���0dn���H/�<�Qa�00/!�/�gpa+�h�$sM���(�^��� �+����J(�kמ��t��nw=cN���˓ۅ�m��C�Q�@
2
- o����gg���)�FT
1
+ �ؘXBNa=*Y��.�m?�����H<R/=�)�0�W���"���j�~ }��O�jTU��H��Oc0�$��Fq| �-���e|�K
2
+ a8p3[�P�Sr������da�H� !t�0�j��ՇyQB;/���ηH巟����z�����4�N�H��/���f�T�;�#;`���@ �V��9�\4>j �Y��N)
@@ -38,7 +38,10 @@ class Dynarex
38
38
  # Dynarex.new '<contacts><summary><schema>contacts/contact(name,age,dob)</schema></summary><records/></contacts>'
39
39
 
40
40
  def initialize(rawx=nil, opt={})
41
-
41
+
42
+ #File.write '/tmp/d.log',''
43
+ #@logger = Logger.new '/tmp/d.log','daily'
44
+ #@logger.debug 'inside intialize'
42
45
  @opt = {username: nil, password: nil}.merge opt
43
46
  @delimiter = ''
44
47
  @spaces_delimited = false
@@ -47,6 +50,7 @@ class Dynarex
47
50
  @records, @flat_records = [], []
48
51
 
49
52
  openx(rawx.clone) if rawx
53
+ #@logger.debug 'doc: ' + @doc.xml.inspect
50
54
 
51
55
  end
52
56
 
@@ -204,11 +208,18 @@ class Dynarex
204
208
 
205
209
  def to_html(domain: '')
206
210
  xsl_buffer = RXFHelper.read(domain + @xslt).first
207
- #jr100316 xslt = Nokogiri::XSLT(xsl_buffer)
208
- #jr100316 xslt.transform(Nokogiri::XML(@doc.to_s)).to_s
209
211
  Rexslt.new(xsl_buffer, @doc).to_s
210
212
  end
211
213
 
214
+ def to_json(pretty: false)
215
+
216
+ records = self.to_h
217
+ summary = self.summary.to_h
218
+
219
+ h = {summary: summary, records: records}
220
+ pretty ? JSON.pretty_generate(h) : h.to_json
221
+ end
222
+
212
223
  def to_s
213
224
 
214
225
  xsl_buffer =<<EOF
@@ -279,7 +290,8 @@ EOF
279
290
 
280
291
  xslt_format = a.join
281
292
 
282
- xsl_buffer.sub!(/\[!regex_values\]/, xslt_format)
293
+ xsl_buffer.sub!(/\[!regex_values\]/, xslt_format)
294
+ File.write '/home/james/liveblog2.xsl', xsl_buffer
283
295
  out = Rexslt.new(xsl_buffer, @doc).to_s
284
296
 
285
297
  header + "--#\n" + out
@@ -547,16 +559,8 @@ EOF
547
559
  end
548
560
  end
549
561
 
550
- #File.open('dynarex.xsl','w'){|f| f.write xslt}
551
- #File.open('dynarex.xml','w'){|f| f.write doc.xml}
552
- #xml = Rexslt.new(xslt, doc.xml).to_s
553
- #=begin
554
- #jr100316 xslt = Nokogiri::XSLT(xslt)
555
- #jr100316 out = xslt.transform(Nokogiri::XML(doc.root.xml)).to_xml \
556
- #jr100316 :save_with => Nokogiri::XML::Node::SaveOptions::NO_DECLARATION
562
+
557
563
  out = Rexslt.new(xslt, @doc).to_s(declaration: false)
558
-
559
- #=end
560
564
 
561
565
  #Rexle.new("<rss version='2.0'>%s</rss>" % xml).xml(pretty: true)
562
566
 
@@ -596,6 +600,7 @@ EOF
596
600
  end
597
601
 
598
602
  def findx_by(field, value)
603
+ #@logger.debug "field: #{field.inspect}, value: #{value.inspect}"
599
604
  (load_records; rebuild_doc) if @dirty_flag == true
600
605
  r = @doc.root.element("records/*[#{field}=\"#{value}\"]")
601
606
  r ? recordx_to_record(r) : nil
@@ -629,17 +634,18 @@ EOF
629
634
  end
630
635
 
631
636
  def display_xml(options={})
632
-
637
+ #@logger.debug 'inside display_xml'
633
638
  opt = {unescape_html: false}.merge options
634
639
 
635
640
  state = :external
636
-
641
+ #@logger.debug 'before diry'
637
642
  if @dirty_flag == true then
638
643
  load_records
639
644
  state = :internal
640
645
  end
641
-
646
+ #@logger.debug 'before rebuilt'
642
647
  doc = rebuild_doc(state)
648
+ #@logger.debug 'after rebuild_doc'
643
649
 
644
650
  if opt[:unescape_html] == true then
645
651
  doc.content(opt)
@@ -1008,9 +1014,10 @@ EOF
1008
1014
  end
1009
1015
 
1010
1016
  def openx(s)
1011
-
1017
+ #@logger.debug 'inside openx'
1012
1018
  if s[/</] then # xml
1013
-
1019
+ #@logger.debug 'regular string'
1020
+ #@logger.debug 's: ' + s.inspect
1014
1021
  buffer = s
1015
1022
 
1016
1023
  elsif s[/[\[\(]/] # schema
@@ -1030,6 +1037,7 @@ EOF
1030
1037
  raise DynarexException, 'file not found: ' + s
1031
1038
  end
1032
1039
  end
1040
+ #@logger.debug 'buffer: ' + buffer[0..120]
1033
1041
 
1034
1042
  if buffer then
1035
1043
 
@@ -1037,6 +1045,7 @@ EOF
1037
1045
  @xslt = raw_stylesheet[/href=["']([^"']+)/,1] if raw_stylesheet
1038
1046
 
1039
1047
  @doc = Rexle.new(buffer) unless @doc
1048
+ #@logger.debug 'openx/@doc : ' + @doc.xml.inspect
1040
1049
  end
1041
1050
 
1042
1051
  return if @doc.root.nil?
@@ -1130,6 +1139,7 @@ EOF
1130
1139
 
1131
1140
  i = @doc.root.xpath('max(records/*/attribute::id)') || 0
1132
1141
  records = @doc.root.xpath('records/*')
1142
+ #@logger.debug 'records: ' + records.inspect
1133
1143
  records = records.take @limit if @limit
1134
1144
 
1135
1145
  recs = records #jr160315 (order == :descending ? records.reverse : records)
@@ -1161,7 +1171,9 @@ EOF
1161
1171
 
1162
1172
  attributes = row.attributes
1163
1173
  result.merge body[@default_key.to_sym] => attributes.merge({id: id, body: body})
1164
- end
1174
+ end
1175
+ #@logger.debug 'a: ' + a.inspect
1176
+ a
1165
1177
 
1166
1178
  end
1167
1179
 
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.2
4
+ version: 1.7.3
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-03-15 00:00:00.000000000 Z
34
+ date: 2016-04-27 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: dynarex-import
@@ -79,20 +79,20 @@ dependencies:
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0.5'
82
+ version: '0.6'
83
83
  - - ">="
84
84
  - !ruby/object:Gem::Version
85
- version: 0.5.0
85
+ version: 0.6.3
86
86
  type: :runtime
87
87
  prerelease: false
88
88
  version_requirements: !ruby/object:Gem::Requirement
89
89
  requirements:
90
90
  - - "~>"
91
91
  - !ruby/object:Gem::Version
92
- version: '0.5'
92
+ version: '0.6'
93
93
  - - ">="
94
94
  - !ruby/object:Gem::Version
95
- version: 0.5.0
95
+ version: 0.6.3
96
96
  - !ruby/object:Gem::Dependency
97
97
  name: dynarex-xslt
98
98
  requirement: !ruby/object:Gem::Requirement
@@ -119,20 +119,20 @@ dependencies:
119
119
  requirements:
120
120
  - - "~>"
121
121
  - !ruby/object:Gem::Version
122
- version: '0.3'
122
+ version: '0.4'
123
123
  - - ">="
124
124
  - !ruby/object:Gem::Version
125
- version: 0.3.1
125
+ version: 0.4.0
126
126
  type: :runtime
127
127
  prerelease: false
128
128
  version_requirements: !ruby/object:Gem::Requirement
129
129
  requirements:
130
130
  - - "~>"
131
131
  - !ruby/object:Gem::Version
132
- version: '0.3'
132
+ version: '0.4'
133
133
  - - ">="
134
134
  - !ruby/object:Gem::Version
135
- version: 0.3.1
135
+ version: 0.4.0
136
136
  - !ruby/object:Gem::Dependency
137
137
  name: rxraw-lineparser
138
138
  requirement: !ruby/object:Gem::Requirement
@@ -159,20 +159,20 @@ dependencies:
159
159
  requirements:
160
160
  - - "~>"
161
161
  - !ruby/object:Gem::Version
162
- version: '0.4'
162
+ version: '0.5'
163
163
  - - ">="
164
164
  - !ruby/object:Gem::Version
165
- version: 0.4.3
165
+ version: 0.5.0
166
166
  type: :runtime
167
167
  prerelease: false
168
168
  version_requirements: !ruby/object:Gem::Requirement
169
169
  requirements:
170
170
  - - "~>"
171
171
  - !ruby/object:Gem::Version
172
- version: '0.4'
172
+ version: '0.5'
173
173
  - - ">="
174
174
  - !ruby/object:Gem::Version
175
- version: 0.4.3
175
+ version: 0.5.0
176
176
  - !ruby/object:Gem::Dependency
177
177
  name: table-formatter
178
178
  requirement: !ruby/object:Gem::Requirement
metadata.gz.sig CHANGED
@@ -1,4 +1,2 @@
1
- \��`;�8�D��B�6xO5EJ�(�FHE�E3��X6+�@{kvQM5�gtC��
2
- l
3
- �s� �k<#|R�릮�s����|-�B�r��6+�S"y2�8 W� I��"~��O�����@�������+���ټ{`C
4
- ���ѯ�.���{���wnξq6���u��Y-���A���!��,E��'���r�FشΈW�;z�.C!��kc7��D�O�~N����d*v�e�Vȼ�jb,��8 ��53�nj
1
+ Q3���Q�٨Ü�_�;/$��B�J&� PM���^�|�3��Xr���h��nV��������A���D`�-o]���ϻ��������1[
2
+ DkKnr�湤y�~I���$�Pv�L��