rxfhelper 0.9.0 → 1.0.0

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: 2cad259a33f498594c719cbdf3e1c7ab254b6aeed6a28a1af4648c0462298f5c
4
- data.tar.gz: 52049d18766c6a9802b6c68dff3e7eba9d596dd32c0b1c1f7db590f6feb0feff
3
+ metadata.gz: af2c431270f26dc19738d58f6c98bca4f8ee236a6c8fc0194e6ae688fb7fad7b
4
+ data.tar.gz: 4dd4d60b7c343bbcd7b0addc8557dc10ad2ba1eeed809d47333fa6ab76671b7c
5
5
  SHA512:
6
- metadata.gz: 8d684ef4dc5a8b28225db54fff32027a7bdafcb6e3073e1a8b1dc64ff15629fa41dfe346aaa8782ddcffb196b93253caa5644b4f9d3214c1f1af1dfe0d07680f
7
- data.tar.gz: f85cadb6c78897db2fe92fd90c2ad3f889891b0984e6486e3fcf7cb25089831b0cf82dae9259839de5a85046bf9b99bcaa32ad09a4052c0e69c3da712ac284c9
6
+ metadata.gz: 892bcb1e06036ce696fc819ec23a72177d0ab15e52b0c144c9630386688777c704439f1cd2e9629383df619abdef3e14ad73d50bda4cd4c3624eeef9c44017f8
7
+ data.tar.gz: ed9230d8269a4e5ea51a2fd3d3c8792501ad930a430991a9a0dd0fb13013ad556cd1580bca6de1ceb33b990ee138b8c54e1d6cee243408204599702cad262626
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -3,17 +3,40 @@
3
3
  # file: rxfhelper.rb
4
4
 
5
5
  require 'rsc'
6
- require 'gpd-request'
6
+ #require 'gpd-request'
7
7
  require 'drb_fileclient'
8
8
  require 'remote_dwsregistry'
9
+ require 'drb_reg_client'
9
10
 
10
11
 
12
+ # Setup: Add a local DNS entry called *reg.lookup* if you are planning on
13
+ # using the Registry feaure to look up objects automatically.
14
+
11
15
  module RXFHelperModule
12
16
 
13
17
  class FileX
14
18
 
15
19
  def self.chdir(s) RXFHelper.chdir(s) end
16
20
 
21
+ def self.directory?(filename)
22
+
23
+ type = self.filetype(filename)
24
+
25
+ filex = case type
26
+ when :file
27
+ File
28
+ when :dfs
29
+ DfsFile
30
+ else
31
+ nil
32
+ end
33
+
34
+ return nil unless filex
35
+
36
+ filex.directory? filename
37
+
38
+ end
39
+
17
40
  def self.exists?(filename)
18
41
 
19
42
  type = self.filetype(filename)
@@ -94,6 +117,7 @@ end
94
117
  # Read XML File Helper
95
118
  #
96
119
  class RXFHelper
120
+ using ColouredText
97
121
 
98
122
  @fs = :local
99
123
 
@@ -118,7 +142,13 @@ class RXFHelper
118
142
  raise RXFHelperException, 'nil found, expected a string' if x.nil?
119
143
 
120
144
  if x[/^rse:\/\//] then
145
+
121
146
  RSC.new.get x
147
+
148
+ elsif x[/^reg:\/\//] then
149
+
150
+ DRbRegClient.new.get(x).value.to_s
151
+
122
152
  else
123
153
  [x, :unknown]
124
154
  end
@@ -159,6 +189,23 @@ class RXFHelper
159
189
  DfsFile.mv(s1, s2)
160
190
  end
161
191
 
192
+ # used by self.read
193
+ #
194
+ def self.objectize(contents)
195
+
196
+ doctype = contents.lines.first[/(?<=^<\?)\w+/]
197
+ reg = RemoteDwsRegistry.new domain: 'reg.lookup', port: '9292'
198
+ r = reg.get_key 'hkey_gems/doctype/' + doctype
199
+
200
+ return contents unless r
201
+
202
+ require r.text('require')
203
+
204
+ obj = Object.const_get(r.text('class')).new
205
+ obj.import contents
206
+ obj
207
+ end
208
+
162
209
  def self.pwd()
163
210
 
164
211
  DfsFile.pwd
@@ -168,6 +215,8 @@ class RXFHelper
168
215
  def self.read(x, h={})
169
216
 
170
217
  opt = {debug: false, auto: false}.merge(h)
218
+
219
+ debug = opt[:debug]
171
220
 
172
221
  puts 'x: ' + x.inspect if opt[:debug]
173
222
  raise RXFHelperException, 'nil found, expected a string' if x.nil?
@@ -182,8 +231,12 @@ class RXFHelper
182
231
 
183
232
  elsif x.lines.length == 1 then
184
233
 
234
+ puts 'x.lines == 1'.info if debug
235
+
185
236
  if x[/\bhttps?:\/\//] then
186
237
 
238
+ puts 'before GPDRequest'.info if debug
239
+
187
240
  r = GPDRequest.new(opt[:username], opt[:password]).get(x)
188
241
 
189
242
  case r.code
@@ -193,38 +246,33 @@ class RXFHelper
193
246
  raise(RXFHelperException, "401 %s unauthorized access" % x)
194
247
  end
195
248
 
196
- [r.body, :url]
249
+ obj = opt[:auto] ? objectize(r.body) : r.body
250
+
251
+ [obj, :url]
197
252
 
198
253
  elsif x[/^dfs:\/\//] then
199
254
 
200
- [DfsFile.read(x), :dfs]
255
+ r = DfsFile.read(x)
256
+ [opt[:auto] ? objectize(r) : r, :dfs]
201
257
 
202
258
  elsif x[/^rse:\/\//] then
203
259
 
204
260
  [RSC.new.get(x), :rse]
205
261
 
262
+ elsif x[/^reg:\/\//] then
263
+
264
+ [DRbRegClient.new.get(x).value.to_s, :reg]
265
+
206
266
  elsif x[/^file:\/\//] or File.exists?(x) then
207
267
 
208
268
  puts 'RXFHelper.read before File.read' if opt[:debug]
209
269
  contents = File.read(File.expand_path(x.sub(%r{^file://}, '')))
210
270
 
211
- puts 'contents: ' + contents.inspect if opt[:debug]
271
+ puts 'contents2: ' + contents.inspect if opt[:debug]
212
272
 
213
- obj = if opt[:auto] then
214
-
215
- doctype = contents.lines.first[/(?<=^<\?)\w+/]
216
- reg = RemoteDwsRegistry.new domain: 'reg', port: '9292'
217
- r = reg.get_key 'hkey_gems/doctype/' + doctype
218
-
219
- return contents unless r
220
-
221
- Object.const_get(r.text('class')).new.import contents
222
-
223
- else
224
-
225
- contents
226
-
227
- end
273
+ puts 'opt: ' + opt.inspect if opt[:debug]
274
+
275
+ obj = opt[:auto] ? objectize(contents) : contents
228
276
 
229
277
  [obj, :file]
230
278
 
@@ -256,6 +304,10 @@ class RXFHelper
256
304
  when /^rse:\/\//
257
305
 
258
306
  RSC.new.post(location, s)
307
+
308
+ when /^reg:\/\//
309
+
310
+ DRbRegClient.new.set(location, s)
259
311
 
260
312
  else
261
313
 
@@ -307,11 +359,32 @@ class RXFHelper
307
359
 
308
360
  if uri[/^rse:\/\//] then
309
361
  RSC.new.post uri, x
362
+
363
+ elsif uri[/^reg:\/\//]
364
+
365
+ DRbRegClient.new.set(uri, x)
310
366
  else
311
367
  [uri, :unknown]
312
368
  end
313
369
 
314
370
  end
371
+
372
+ def self.set(uri, x=nil)
373
+
374
+ raise RXFHelperException, 'nil found, expected a string' if uri.nil?
375
+ puts 'uri: ' + uri.inspect
376
+
377
+ if uri[/^rse:\/\//] then
378
+ RSC.new.post uri, x
379
+
380
+ elsif uri[/^reg:\/\//]
381
+
382
+ DRbRegClient.new.set(uri, x)
383
+ else
384
+ [uri, :unknown]
385
+ end
386
+
387
+ end
315
388
 
316
389
  def self.zip(filename, a)
317
390
  DfsFile.zip(filename, a)
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.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -11,31 +11,31 @@ cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
13
  MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
14
- YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMTgxMDE0MTQ0MzAzWhcN
15
- MTkxMDE0MTQ0MzAzWjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
16
- cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQCsJLak
17
- 8x/bQsFPNMV6KHIGMdMX58UFTgMRgOU2tjkpsSZcWVUmVnrBLCtOIFSC4zF2LYn3
18
- HWkSUSK1wj8waTLd5bLP6QM3qXRFA80gVhLDbR1z16bt3mk2f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AYEAbFZxX9OnCmYMpYDx7687JBRHdse2aegPHz9ikdkq
29
+ CY8aRsfKnomGy7tVz/Peb3o+CR7f4fZmxFL7H/eAx5clIaDnEYwoy9v5zEODp6rP
30
+ l7pHGM+nOFZ8XBtuxobHeab20cmvWrsRhqU41+8TN5PTeiu+6YKzMIUDhquTLD4p
31
+ 7945EAFx5FR++oaAaQ8mvE1UaszulxRUYMD1fdhwmU0/MNyVmsxkA6Z73pnH5+9r
32
+ vQg/xEWCISwNPDQ8QkREppd8R15YZoUK+McO0DKdJNKHvLeBpTAtzniHKhSJWIJs
33
+ 3Y7aVjx4ObmwUZSTacnTquQMf/TamZ/T0Ve4THAillF+cXFbXwmWGsoSQbAL7dnx
34
+ qwgCPezsVLzI8dyGDAaKwdnIItN+vIp0EL3/bE1XUY1QwIKGbbI7inSO1Fs0IKFS
35
+ jqz35QOVAJp+XW1qrnZM464OWlao2nDvKZrkO1pC9jbMUo+eLb8FgqycXd26ZpRf
36
+ RXFUTIU85mvSCH+/CcNAooQi
37
37
  -----END CERTIFICATE-----
38
- date: 2018-10-14 00:00:00.000000000 Z
38
+ date: 2020-06-08 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: rsc
@@ -46,7 +46,7 @@ dependencies:
46
46
  version: '0.4'
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: 0.4.1
49
+ version: 0.4.4
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
@@ -56,29 +56,29 @@ dependencies:
56
56
  version: '0.4'
57
57
  - - ">="
58
58
  - !ruby/object:Gem::Version
59
- version: 0.4.1
59
+ version: 0.4.4
60
60
  - !ruby/object:Gem::Dependency
61
- name: gpd-request
61
+ name: drb_fileclient
62
62
  requirement: !ruby/object:Gem::Requirement
63
63
  requirements:
64
64
  - - "~>"
65
65
  - !ruby/object:Gem::Version
66
- version: '0.3'
66
+ version: '0.5'
67
67
  - - ">="
68
68
  - !ruby/object:Gem::Version
69
- version: 0.3.0
69
+ version: 0.5.2
70
70
  type: :runtime
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - "~>"
75
75
  - !ruby/object:Gem::Version
76
- version: '0.3'
76
+ version: '0.5'
77
77
  - - ">="
78
78
  - !ruby/object:Gem::Version
79
- version: 0.3.0
79
+ version: 0.5.2
80
80
  - !ruby/object:Gem::Dependency
81
- name: drb_fileclient
81
+ name: remote_dwsregistry
82
82
  requirement: !ruby/object:Gem::Requirement
83
83
  requirements:
84
84
  - - "~>"
@@ -86,7 +86,7 @@ dependencies:
86
86
  version: '0.4'
87
87
  - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: 0.4.5
89
+ version: 0.4.1
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
@@ -96,27 +96,27 @@ dependencies:
96
96
  version: '0.4'
97
97
  - - ">="
98
98
  - !ruby/object:Gem::Version
99
- version: 0.4.5
99
+ version: 0.4.1
100
100
  - !ruby/object:Gem::Dependency
101
- name: remote_dwsregistry
101
+ name: drb_reg_client
102
102
  requirement: !ruby/object:Gem::Requirement
103
103
  requirements:
104
104
  - - "~>"
105
105
  - !ruby/object:Gem::Version
106
- version: '0.3'
106
+ version: '0.1'
107
107
  - - ">="
108
108
  - !ruby/object:Gem::Version
109
- version: 0.3.0
109
+ version: 0.1.3
110
110
  type: :runtime
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
114
  - - "~>"
115
115
  - !ruby/object:Gem::Version
116
- version: '0.3'
116
+ version: '0.1'
117
117
  - - ">="
118
118
  - !ruby/object:Gem::Version
119
- version: 0.3.0
119
+ version: 0.1.3
120
120
  description:
121
121
  email: james@jamesrobertson.eu
122
122
  executables: []
@@ -143,8 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
143
  - !ruby/object:Gem::Version
144
144
  version: '0'
145
145
  requirements: []
146
- rubyforge_project:
147
- rubygems_version: 2.7.6
146
+ rubygems_version: 3.0.3
148
147
  signing_key:
149
148
  specification_version: 4
150
149
  summary: Helpful library for primarily reading the contents of a file either from
metadata.gz.sig CHANGED
@@ -1 +1,4 @@
1
- N{je;��<�ӹ�k�w3NP`|Ǭ?^�~s���1�X�������n� y��!C����ѣy�)��f!�\c؏�vf&�Š�� i'pb˥>l��YO��bB?oNE�<��=��c��r��00t�s����s5P�^,*��sP���Mⱒ��=�x�� �� )u���UQb �])��ks���|cA�%, �av���MQ ���@�ەT�x��Y#n��S ��JG ›K_uL�E���~t�����'���r���<��\��϶y����Y��U���6!.���t&
1
+ ��:���l9�����}RA)�����GY_X�r���Do ��������B��R�x�
2
+ s4�%S�q��k�xǏGt�����y�қ�e���$0� ������W�M����2��L���!c�#w14��r����,��i�[��(Q,�Ko'G���:]l�� �
3
+ UUմ�i�G�)j�D�h�M7)QJmw37�L���S�U�g��:�(s2Dâ�T'�`��9�pƾ��VC-��ln��-������,:��
4
+ P�[s}�ra�)����0�����q=.�r�� b�'r*.���m���̛2)�����s�,6?�ݚq�G�o����؟H�D.��&=v_�ҳ�5�