rxfhelper 1.1.4 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7b2b3cae6cf8bea604db55ccbbcaaaa66d0520beda41c176bcda8c7e9ddcc4df
4
- data.tar.gz: e20c05524b6824edfb440ce5ef94938bc00bb189f2251e9005b1bbb0c218b719
3
+ metadata.gz: 28e436ed54b4585bc6386e61934df9ef818720c3bda4948df520c44c9d0671bc
4
+ data.tar.gz: bed423faffffcee3e793eb0e2c739302a65f8e4d36241a4902c337bb07bb455f
5
5
  SHA512:
6
- metadata.gz: c856678181998759bfeb49ab9e70ee3d2ba3d493a1c08005bfef02857add70a5bd98fbf9d6564058a7f0c8fefd3d70d99a7ba17d693591d111665082f860850b
7
- data.tar.gz: 35350a3aa442e65836e1331ecad56883373ff7820f26b775ade08888e72c5ed316c9587eacda8c2a016ca8016603fb754b6fa0dc66b1c29c0468b8ec886db567
6
+ metadata.gz: c13aa7cd67307d6b551fe77d56e326f077f47ab84f1ca1343ec60891b94545957d8d858884296d7c19118bda9d343bbad890deb97b245d58bcfc62f36e4ca74c
7
+ data.tar.gz: 8369514628a2a8993ea66fb7fb8623ed0771818df78dad09b6bc1c3ea7bfd4b7b230a39504c762d18c6aca4537f0b7af4c56499ee7c578b1445aec59d2c06e28
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/rxfhelper.rb CHANGED
@@ -4,6 +4,7 @@
4
4
 
5
5
  require 'rsc'
6
6
  #require 'gpd-request'
7
+ require 'rest-client'
7
8
  require 'mymedia_ftp'
8
9
  require 'drb_fileclient'
9
10
  require 'drb_reg_client'
@@ -11,7 +12,7 @@ require 'remote_dwsregistry'
11
12
 
12
13
 
13
14
 
14
- # Setup: Add a local DNS entry called *reg.lookup* if you are planning on
15
+ # Setup: Add a local DNS entry called *reg.lookup* if you are planning on
15
16
  # using the Registry feaure to look up objects automatically.
16
17
 
17
18
  module RXFHelperModule
@@ -109,6 +110,7 @@ module RXFHelperModule
109
110
  def self.pwd() RXFHelper.pwd() end
110
111
  def self.read(x) RXFHelper.read(x).first end
111
112
  def self.rm(s) RXFHelper.rm(s) end
113
+ def self.touch(s) RXFHelper.touch(s) end
112
114
  def self.write(x, s) RXFHelper.write(x, s) end
113
115
  def self.zip(s, a) RXFHelper.zip(s, a) end
114
116
 
@@ -153,7 +155,7 @@ class RXFHelper
153
155
  return unless permissions.is_a? Integer
154
156
  return unless s.is_a? String
155
157
 
156
- if s[/^dfs:\/\//] or @fs == :dfs then
158
+ if s[/^dfs:\/\//] or @fs[0..2] == 'dfs' then
157
159
  DfsFile.chmod permissions, s
158
160
  else
159
161
  FileUtils.chmod permissions, s
@@ -161,17 +163,20 @@ class RXFHelper
161
163
 
162
164
  end
163
165
 
164
- def self.cp(s1, s2)
166
+ def self.cp(s1, s2, debug: false)
167
+
168
+ puts 'inside RXFHelper.cp' if debug
165
169
 
166
170
  found = [s1,s2].grep /^\w+:\/\//
171
+ puts 'found: ' + found.inspect if debug
167
172
 
168
- if found then
173
+ if found.any? then
169
174
 
170
- case found.first[/^\w+(?=:\/\/)/].to_sym
175
+ case found.first[/^\w+(?=:\/\/)/]
171
176
 
172
- when :dfs
177
+ when 'dfs'
173
178
  DfsFile.cp(s1, s2)
174
- when :ftp
179
+ when 'ftp'
175
180
  MyMediaFTP.cp s1, s2
176
181
  else
177
182
 
@@ -186,12 +191,22 @@ class RXFHelper
186
191
 
187
192
  def self.chdir(x)
188
193
 
194
+ # We can use @fs within chdir() to flag the current file system.
195
+ # Allowing us to use relative paths with FileX operations instead
196
+ # of explicitly stating the path each time. e.g. touch 'foo.txt'
197
+ #
198
+
189
199
  if x[/^file:\/\//] or File.exists?(File.dirname(x)) then
200
+
190
201
  @fs = :local
191
202
  FileUtils.chdir x
203
+
192
204
  elsif x[/^dfs:\/\//]
193
- @fs = :dfs
205
+
206
+ host = x[/(?<=dfs:\/\/)[^\/]+/]
207
+ @fs = 'dfs://' + host
194
208
  DfsFile.chdir x
209
+
195
210
  end
196
211
 
197
212
  end
@@ -229,12 +244,12 @@ class RXFHelper
229
244
 
230
245
  return Dir[x] if File.exists?(File.dirname(x))
231
246
 
232
- case x[/^\w+(?=:\/\/)/].to_sym
233
- when :file
247
+ case x[/^\w+(?=:\/\/)/]
248
+ when 'file'
234
249
  Dir[x]
235
- when :dfs
250
+ when 'dfs'
236
251
  DfsFile.ls x
237
- when :ftp
252
+ when 'ftp'
238
253
  MyMediaFTP.ls x
239
254
  else
240
255
 
@@ -254,7 +269,7 @@ class RXFHelper
254
269
 
255
270
  def self.mkdir_p(x)
256
271
 
257
- if x[/^dfs:\/\//] or @fs == :dfs then
272
+ if x[/^dfs:\/\//] or @fs[0..2] == 'dfs' then
258
273
  DfsFile.mkdir_p x
259
274
  else
260
275
  FileUtils.mkdir_p x
@@ -314,7 +329,11 @@ class RXFHelper
314
329
 
315
330
  puts 'before GPDRequest'.info if debug
316
331
 
317
- r = GPDRequest.new(opt[:username], opt[:password]).get(x)
332
+ r = if opt[:username] and opt[:password] then
333
+ GPDRequest.new(opt[:username], opt[:password]).get(x)
334
+ else
335
+ response = RestClient.get(x)
336
+ end
318
337
 
319
338
  case r.code
320
339
  when '404'
@@ -374,13 +393,30 @@ class RXFHelper
374
393
 
375
394
  def self.rm(filename)
376
395
 
377
- case filename[/^\w+(?=:\/\/)/].to_sym
378
- when :dfs
396
+ case filename[/^\w+(?=:\/\/)/]
397
+ when 'dfs'
379
398
  DfsFile.rm filename
380
- when :ftp
399
+ when 'ftp'
381
400
  MyMediaFTP.rm filename
382
401
  else
402
+ FileUtils.rm
403
+ end
404
+
405
+ end
383
406
 
407
+ def self.touch(filename)
408
+
409
+ if @fs[0..2] == 'dfs' then
410
+ return DfsFile.touch(@fs + pwd + '/' + filename)
411
+ end
412
+
413
+ case filename[/^\w+(?=:\/\/)/]
414
+ when 'dfs'
415
+ DfsFile.touch filename
416
+ when 'ftp'
417
+ MyMediaFTP.touch filename
418
+ else
419
+ FileUtils.touch filename
384
420
  end
385
421
 
386
422
  end
data.tar.gz.sig CHANGED
@@ -1,3 +1 @@
1
- o+%wk����PX�SG�������xkA�$k_w��ޣ�k-�k2���?�
2
- �Ų&�=pL�1(���8��&�i�@S�����Ϧ�#�D�JO�D��M0tÔj�����5 ��S�48�������u���q���0#�6ET�h#<�
3
- ͯ���������� �r�3� �p$���/��,�|�.���5�E�zU�g���2]q���V�4d��Y&I���g&�-�JK��蓐�\Q8i�ȼ���.fsW����q�-���u����E��Ee_W_k3w`�c�����ή�Z����-��D*Y #4�"�!s$P]iEB���IP�G=C���j[�̢�E��
1
+ &��=�;���o��Ȇ���X��0äVX6,Uݍ��Rim��L���F�R��]+�*i8˯*�vf"Ӯ �M����\�|�G�e��4Zv�[V�cLC��L�w')B� �y,Ę+wM'��g�ֵ��@�\���ҕ\
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: 1.1.4
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,7 +35,7 @@ cert_chain:
35
35
  MrrH8cS6bqJRPQqEL1FsPmXfQpp86RvPSr0WqNSRnYEUCmqL0l2pYrXdPAyBLcji
36
36
  X1jPyhH0sl/QdPdaUnsigze+
37
37
  -----END CERTIFICATE-----
38
- date: 2022-01-18 00:00:00.000000000 Z
38
+ date: 2022-02-07 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: rsc
@@ -137,6 +137,26 @@ dependencies:
137
137
  - - "~>"
138
138
  - !ruby/object:Gem::Version
139
139
  version: '0.2'
140
+ - !ruby/object:Gem::Dependency
141
+ name: rest-client
142
+ requirement: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: 2.1.0
147
+ - - "~>"
148
+ - !ruby/object:Gem::Version
149
+ version: '2.1'
150
+ type: :runtime
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ requirements:
154
+ - - ">="
155
+ - !ruby/object:Gem::Version
156
+ version: 2.1.0
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: '2.1'
140
160
  description:
141
161
  email: digital.robertson@gmail.com
142
162
  executables: []
metadata.gz.sig CHANGED
Binary file