rxfhelper 0.9.1 → 0.9.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9e1e52810e2517ff7876a47943781bf3fd7ff1220d883f0eb78a380d5e58e0d8
4
- data.tar.gz: 4e3ba3c6dcc781f6fd497caf5dad53c6b7f67312c7a6c7d3ffff07ecc3a67745
3
+ metadata.gz: 37c5247bbc525a9b4310d111f02237b3d643251c5c9be907bd7e8d4259da13fb
4
+ data.tar.gz: 71793ac9b2b51f3d43d9357871d4bc41d6b86e79364d1e2680dd71d29963a7d2
5
5
  SHA512:
6
- metadata.gz: 5627fe3e97c9453fa1dac8ce8ffaa140be430096a9492306830ffb0578c138be9e6ba47e73b56179640ad44378b71e3638566a772846b41b808ccade77c5f4e4
7
- data.tar.gz: 4aaba1cd307cc62420ea24cc25f2032a2c044c260302d32987c4f3aac4339b2372800563d7867a6b2e790546e52e7059558f6959b0e40a20b9e679f494384caf
6
+ metadata.gz: 8cb3e32a2b80d372c131a0d626b0ce69de8d9fb698d1bd4bdfea4a5c8fbaa7569d7a3b04112f8550490d33e693b4c80b3deb5013428f48ed15414c2b6ece85e7
7
+ data.tar.gz: 97c66de7c737d25ce802b296eec5faade73e7b25a36b733ff1baa61e7abca1f4499d70fac3965ddb8ded365786afa6515e604d34e3aa17ad3e3e8ffc005d6bec
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -94,6 +94,7 @@ end
94
94
  # Read XML File Helper
95
95
  #
96
96
  class RXFHelper
97
+ using ColouredText
97
98
 
98
99
  @fs = :local
99
100
 
@@ -159,6 +160,23 @@ class RXFHelper
159
160
  DfsFile.mv(s1, s2)
160
161
  end
161
162
 
163
+ # used by self.read
164
+ #
165
+ def self.objectize(contents)
166
+
167
+ doctype = contents.lines.first[/(?<=^<\?)\w+/]
168
+ reg = RemoteDwsRegistry.new domain: 'reg', port: '9292'
169
+ r = reg.get_key 'hkey_gems/doctype/' + doctype
170
+
171
+ return contents unless r
172
+
173
+ require r.text('require')
174
+
175
+ obj = Object.const_get(r.text('class')).new
176
+ obj.import contents
177
+ obj
178
+ end
179
+
162
180
  def self.pwd()
163
181
 
164
182
  DfsFile.pwd
@@ -168,6 +186,8 @@ class RXFHelper
168
186
  def self.read(x, h={})
169
187
 
170
188
  opt = {debug: false, auto: false}.merge(h)
189
+
190
+ debug = opt[:debug]
171
191
 
172
192
  puts 'x: ' + x.inspect if opt[:debug]
173
193
  raise RXFHelperException, 'nil found, expected a string' if x.nil?
@@ -182,8 +202,12 @@ class RXFHelper
182
202
 
183
203
  elsif x.lines.length == 1 then
184
204
 
205
+ puts 'x.lines == 1'.info if debug
206
+
185
207
  if x[/\bhttps?:\/\//] then
186
208
 
209
+ puts 'before GPDRequest'.info if debug
210
+
187
211
  r = GPDRequest.new(opt[:username], opt[:password]).get(x)
188
212
 
189
213
  case r.code
@@ -193,7 +217,9 @@ class RXFHelper
193
217
  raise(RXFHelperException, "401 %s unauthorized access" % x)
194
218
  end
195
219
 
196
- [r.body, :url]
220
+ obj = opt[:auto] ? objectize(r.body) : r.body
221
+
222
+ [obj, :url]
197
223
 
198
224
  elsif x[/^dfs:\/\//] then
199
225
 
@@ -212,27 +238,7 @@ class RXFHelper
212
238
 
213
239
  puts 'opt: ' + opt.inspect if opt[:debug]
214
240
 
215
- obj = if opt[:auto] then
216
-
217
- doctype = contents.lines.first[/(?<=^<\?)\w+/]
218
- reg = RemoteDwsRegistry.new domain: 'reg', port: '9292'
219
- r = reg.get_key 'hkey_gems/doctype/' + doctype
220
-
221
- puts 'r: ' + r.inspect if opt[:debug]
222
-
223
- return contents unless r
224
-
225
- require r.text('require')
226
-
227
- obj = Object.const_get(r.text('class')).new
228
- obj.import contents
229
- obj
230
-
231
- else
232
-
233
- contents
234
-
235
- end
241
+ obj = opt[:auto] ? objectize(contents) : contents
236
242
 
237
243
  [obj, :file]
238
244
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rxfhelper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,7 +35,7 @@ cert_chain:
35
35
  +rB3ZZRITz3UYJX4CRAhjbCFz5Cxnpy9Vak6Qd9BWwl5Zv09QPxO3W+CIFDO+VpN
36
36
  MnDB4XRJPLbz3OzpiLtqEWES
37
37
  -----END CERTIFICATE-----
38
- date: 2018-10-15 00:00:00.000000000 Z
38
+ date: 2018-12-23 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: rsc
metadata.gz.sig CHANGED
Binary file