rxfhelper 0.9.1 → 1.0.1

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.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/lib/rxfhelper.rb +103 -23
  5. metadata +53 -34
  6. metadata.gz.sig +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9e1e52810e2517ff7876a47943781bf3fd7ff1220d883f0eb78a380d5e58e0d8
4
- data.tar.gz: 4e3ba3c6dcc781f6fd497caf5dad53c6b7f67312c7a6c7d3ffff07ecc3a67745
3
+ metadata.gz: ff43af9d740c441437ba6029e993b8eacd719318a0df57c761663a5c7adc9059
4
+ data.tar.gz: 31b8aa71e2a26a2f7109ab3e9f79fab44e0b31c96d206a62e6d559d05845cbd1
5
5
  SHA512:
6
- metadata.gz: 5627fe3e97c9453fa1dac8ce8ffaa140be430096a9492306830ffb0578c138be9e6ba47e73b56179640ad44378b71e3638566a772846b41b808ccade77c5f4e4
7
- data.tar.gz: 4aaba1cd307cc62420ea24cc25f2032a2c044c260302d32987c4f3aac4339b2372800563d7867a6b2e790546e52e7059558f6959b0e40a20b9e679f494384caf
6
+ metadata.gz: dda4a32dbd4520500effc0c9ee57ff5850774756c538428f1ef84e4d0a7d6c5c5abede585085ec3840846ed36a426a8acea3f0f6b6fca1c4cae9b1f4b5d93cd3
7
+ data.tar.gz: ae428203d8bf52e0e03bcf862beddc62f56351212772dedb475dbb3d29bab57e97786f316d603ffa555f52054e2a518491605f96914ac89650ed4b65c3fbc705
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -6,14 +6,37 @@ require 'rsc'
6
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,9 +117,25 @@ end
94
117
  # Read XML File Helper
95
118
  #
96
119
  class RXFHelper
120
+ using ColouredText
97
121
 
98
122
  @fs = :local
99
123
 
124
+ def self.call(s)
125
+
126
+ if s =~ /=/ then
127
+
128
+ uri, val = s.split(/=/)
129
+ self.set uri, val
130
+
131
+ else
132
+
133
+ self.get s
134
+
135
+ end
136
+
137
+ end
138
+
100
139
  def self.cp(s1, s2)
101
140
  DfsFile.cp(s1, s2)
102
141
  end
@@ -118,7 +157,13 @@ class RXFHelper
118
157
  raise RXFHelperException, 'nil found, expected a string' if x.nil?
119
158
 
120
159
  if x[/^rse:\/\//] then
160
+
121
161
  RSC.new.get x
162
+
163
+ elsif x[/^reg:\/\//] then
164
+
165
+ DRbRegClient.new.get(x).value.to_s
166
+
122
167
  else
123
168
  [x, :unknown]
124
169
  end
@@ -159,6 +204,23 @@ class RXFHelper
159
204
  DfsFile.mv(s1, s2)
160
205
  end
161
206
 
207
+ # used by self.read
208
+ #
209
+ def self.objectize(contents)
210
+
211
+ doctype = contents.lines.first[/(?<=^<\?)\w+/]
212
+ reg = RemoteDwsRegistry.new domain: 'reg.lookup', port: '9292'
213
+ r = reg.get_key 'hkey_gems/doctype/' + doctype
214
+
215
+ return contents unless r
216
+
217
+ require r.text('require')
218
+
219
+ obj = Object.const_get(r.text('class')).new
220
+ obj.import contents
221
+ obj
222
+ end
223
+
162
224
  def self.pwd()
163
225
 
164
226
  DfsFile.pwd
@@ -168,6 +230,8 @@ class RXFHelper
168
230
  def self.read(x, h={})
169
231
 
170
232
  opt = {debug: false, auto: false}.merge(h)
233
+
234
+ debug = opt[:debug]
171
235
 
172
236
  puts 'x: ' + x.inspect if opt[:debug]
173
237
  raise RXFHelperException, 'nil found, expected a string' if x.nil?
@@ -182,8 +246,12 @@ class RXFHelper
182
246
 
183
247
  elsif x.lines.length == 1 then
184
248
 
249
+ puts 'x.lines == 1'.info if debug
250
+
185
251
  if x[/\bhttps?:\/\//] then
186
252
 
253
+ puts 'before GPDRequest'.info if debug
254
+
187
255
  r = GPDRequest.new(opt[:username], opt[:password]).get(x)
188
256
 
189
257
  case r.code
@@ -193,16 +261,23 @@ class RXFHelper
193
261
  raise(RXFHelperException, "401 %s unauthorized access" % x)
194
262
  end
195
263
 
196
- [r.body, :url]
264
+ obj = opt[:auto] ? objectize(r.body) : r.body
265
+
266
+ [obj, :url]
197
267
 
198
268
  elsif x[/^dfs:\/\//] then
199
269
 
200
- [DfsFile.read(x), :dfs]
270
+ r = DfsFile.read(x)
271
+ [opt[:auto] ? objectize(r) : r, :dfs]
201
272
 
202
273
  elsif x[/^rse:\/\//] then
203
274
 
204
275
  [RSC.new.get(x), :rse]
205
276
 
277
+ elsif x[/^reg:\/\//] then
278
+
279
+ [DRbRegClient.new.get(x).value.to_s, :reg]
280
+
206
281
  elsif x[/^file:\/\//] or File.exists?(x) then
207
282
 
208
283
  puts 'RXFHelper.read before File.read' if opt[:debug]
@@ -212,27 +287,7 @@ class RXFHelper
212
287
 
213
288
  puts 'opt: ' + opt.inspect if opt[:debug]
214
289
 
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
290
+ obj = opt[:auto] ? objectize(contents) : contents
236
291
 
237
292
  [obj, :file]
238
293
 
@@ -264,6 +319,10 @@ class RXFHelper
264
319
  when /^rse:\/\//
265
320
 
266
321
  RSC.new.post(location, s)
322
+
323
+ when /^reg:\/\//
324
+
325
+ DRbRegClient.new.set(location, s)
267
326
 
268
327
  else
269
328
 
@@ -315,11 +374,32 @@ class RXFHelper
315
374
 
316
375
  if uri[/^rse:\/\//] then
317
376
  RSC.new.post uri, x
377
+
378
+ elsif uri[/^reg:\/\//]
379
+
380
+ DRbRegClient.new.set(uri, x)
318
381
  else
319
382
  [uri, :unknown]
320
383
  end
321
384
 
322
385
  end
386
+
387
+ def self.set(uri, x=nil)
388
+
389
+ raise RXFHelperException, 'nil found, expected a string' if uri.nil?
390
+ puts 'uri: ' + uri.inspect
391
+
392
+ if uri[/^rse:\/\//] then
393
+ RSC.new.post uri, x
394
+
395
+ elsif uri[/^reg:\/\//]
396
+
397
+ DRbRegClient.new.set(uri, x)
398
+ else
399
+ [uri, :unknown]
400
+ end
401
+
402
+ end
323
403
 
324
404
  def self.zip(filename, a)
325
405
  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.1
4
+ version: 1.0.1
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
- MTkxMDE0MTQ0MzAzWjAsMSowKAYDVQQDDCFnZW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fZst8mg1yIAz5jOa1TUn2
34
- Cv5RLCA9jbkQUIUcftF9CEHTIJh1zQJbAWFabOm0hR6E0x8awDXr+EEkTOwYeWSv
35
- +rB3ZZRITz3UYJX4CRAhjbCFz5Cxnpy9Vak6Qd9BWwl5Zv09QPxO3W+CIFDO+VpN
36
- MnDB4XRJPLbz3OzpiLtqEWES
28
+ BgkqhkiG9w0BAQsFAAOCAYEAbFZxX9OnCmYMpYDx7687JBRHdse2aegPHz9ikdkq
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-15 00:00:00.000000000 Z
38
+ date: 2020-08-26 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,27 +56,27 @@ 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
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.4'
66
+ version: '0.5'
67
67
  - - ">="
68
68
  - !ruby/object:Gem::Version
69
- version: 0.4.5
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.4'
76
+ version: '0.5'
77
77
  - - ">="
78
78
  - !ruby/object:Gem::Version
79
- version: 0.4.5
79
+ version: 0.5.2
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: remote_dwsregistry
82
82
  requirement: !ruby/object:Gem::Requirement
@@ -86,7 +86,7 @@ dependencies:
86
86
  version: '0.4'
87
87
  - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: 0.4.0
89
+ version: 0.4.1
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
@@ -96,7 +96,27 @@ dependencies:
96
96
  version: '0.4'
97
97
  - - ">="
98
98
  - !ruby/object:Gem::Version
99
- version: 0.4.0
99
+ version: 0.4.1
100
+ - !ruby/object:Gem::Dependency
101
+ name: drb_reg_client
102
+ requirement: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - "~>"
105
+ - !ruby/object:Gem::Version
106
+ version: '0.1'
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: 0.1.3
110
+ type: :runtime
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: '0.1'
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: 0.1.3
100
120
  description:
101
121
  email: james@jamesrobertson.eu
102
122
  executables: []
@@ -123,8 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
143
  - !ruby/object:Gem::Version
124
144
  version: '0'
125
145
  requirements: []
126
- rubyforge_project:
127
- rubygems_version: 2.7.6
146
+ rubygems_version: 3.0.3
128
147
  signing_key:
129
148
  specification_version: 4
130
149
  summary: Helpful library for primarily reading the contents of a file either from
metadata.gz.sig CHANGED
Binary file