rxfhelper 1.2.1 → 1.2.5

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: 29cc7ef15cdde9ea18e774020430180ffaceee84a40a8d2d7a9e4b818128bd02
4
- data.tar.gz: 42ba6529130a99530d694edc478687d9d236b41d825567a5e23d4fc3a9f36981
3
+ metadata.gz: 76dffb3300ae6df8b167768644a86bb625500ac20d71bf5e6f875b5c51678366
4
+ data.tar.gz: aca01289710acc2d57f1bc96bfa5fbfb411ac72b600aba575fe1855033018464
5
5
  SHA512:
6
- metadata.gz: d26bcdad8cb81db235287aeaefcb3babf381fa4a00acdf474780c2e587fe9dea63afc3b52f7ca054fd6094815c91246f693e1c25a64955c6b4ea851c4cf12575
7
- data.tar.gz: 6a09545d67d56d32022d3d5409f2f9dff07c6f49ec9c4b216275ba3d1aa9139d169af469eef868153cde714ab909501f6745fb359e14d944690837ac34875e4b
6
+ metadata.gz: 2557f0dae71e0eedbd484597d03eaaf5978fc2fa3b0fc62c63a3357d40b931cf8d319b55ef61a4e0d80a8791077ed25f76406377d16afc88adc7f6bceb2e2ba5
7
+ data.tar.gz: 9a3eb0e319532abe16aee8dec70c6f576b2c881debe3f5ddad7c76ccdf2c66d9891df87bc785624a67072778169ad0001d01aff756b9570cd402d2e758f94ed7
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/rxfhelper.rb CHANGED
@@ -12,7 +12,7 @@ require 'remote_dwsregistry'
12
12
 
13
13
 
14
14
 
15
- # 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
16
16
  # using the Registry feaure to look up objects automatically.
17
17
 
18
18
  module RXFHelperModule
@@ -110,6 +110,11 @@ module RXFHelperModule
110
110
  def self.pwd() RXFHelper.pwd() end
111
111
  def self.read(x) RXFHelper.read(x).first end
112
112
  def self.rm(s) RXFHelper.rm(s) end
113
+
114
+ def self.touch(s, mtime: Time.now)
115
+ RXFHelper.touch(s, mtime: mtime)
116
+ end
117
+
113
118
  def self.write(x, s) RXFHelper.write(x, s) end
114
119
  def self.zip(s, a) RXFHelper.zip(s, a) end
115
120
 
@@ -154,7 +159,7 @@ class RXFHelper
154
159
  return unless permissions.is_a? Integer
155
160
  return unless s.is_a? String
156
161
 
157
- if s[/^dfs:\/\//] or @fs == :dfs then
162
+ if s[/^dfs:\/\//] or @fs[0..2] == 'dfs' then
158
163
  DfsFile.chmod permissions, s
159
164
  else
160
165
  FileUtils.chmod permissions, s
@@ -162,17 +167,20 @@ class RXFHelper
162
167
 
163
168
  end
164
169
 
165
- def self.cp(s1, s2)
170
+ def self.cp(s1, s2, debug: false)
171
+
172
+ puts 'inside RXFHelper.cp' if debug
166
173
 
167
174
  found = [s1,s2].grep /^\w+:\/\//
175
+ puts 'found: ' + found.inspect if debug
168
176
 
169
- if found then
177
+ if found.any? then
170
178
 
171
- case found.first[/^\w+(?=:\/\/)/].to_sym
179
+ case found.first[/^\w+(?=:\/\/)/]
172
180
 
173
- when :dfs
181
+ when 'dfs'
174
182
  DfsFile.cp(s1, s2)
175
- when :ftp
183
+ when 'ftp'
176
184
  MyMediaFTP.cp s1, s2
177
185
  else
178
186
 
@@ -187,12 +195,22 @@ class RXFHelper
187
195
 
188
196
  def self.chdir(x)
189
197
 
198
+ # We can use @fs within chdir() to flag the current file system.
199
+ # Allowing us to use relative paths with FileX operations instead
200
+ # of explicitly stating the path each time. e.g. touch 'foo.txt'
201
+ #
202
+
190
203
  if x[/^file:\/\//] or File.exists?(File.dirname(x)) then
204
+
191
205
  @fs = :local
192
206
  FileUtils.chdir x
207
+
193
208
  elsif x[/^dfs:\/\//]
194
- @fs = :dfs
209
+
210
+ host = x[/(?<=dfs:\/\/)[^\/]+/]
211
+ @fs = 'dfs://' + host
195
212
  DfsFile.chdir x
213
+
196
214
  end
197
215
 
198
216
  end
@@ -230,12 +248,12 @@ class RXFHelper
230
248
 
231
249
  return Dir[x] if File.exists?(File.dirname(x))
232
250
 
233
- case x[/^\w+(?=:\/\/)/].to_sym
234
- when :file
251
+ case x[/^\w+(?=:\/\/)/]
252
+ when 'file'
235
253
  Dir[x]
236
- when :dfs
254
+ when 'dfs'
237
255
  DfsFile.ls x
238
- when :ftp
256
+ when 'ftp'
239
257
  MyMediaFTP.ls x
240
258
  else
241
259
 
@@ -255,7 +273,7 @@ class RXFHelper
255
273
 
256
274
  def self.mkdir_p(x)
257
275
 
258
- if x[/^dfs:\/\//] or @fs == :dfs then
276
+ if x[/^dfs:\/\//] or @fs[0..2] == 'dfs' then
259
277
  DfsFile.mkdir_p x
260
278
  else
261
279
  FileUtils.mkdir_p x
@@ -379,13 +397,36 @@ class RXFHelper
379
397
 
380
398
  def self.rm(filename)
381
399
 
382
- case filename[/^\w+(?=:\/\/)/].to_sym
383
- when :dfs
400
+ case filename[/^\w+(?=:\/\/)/]
401
+ when 'dfs'
384
402
  DfsFile.rm filename
385
- when :ftp
403
+ when 'ftp'
386
404
  MyMediaFTP.rm filename
387
405
  else
388
406
 
407
+ if File.basename(filename) =~ /\*/ then
408
+ Dir.glob(filename).each {|file| FileUtils.rm file }
409
+ else
410
+ FileUtils.rm filename
411
+ end
412
+
413
+ end
414
+
415
+ end
416
+
417
+ def self.touch(filename, mtime: Time.now)
418
+
419
+ if @fs[0..2] == 'dfs' then
420
+ return DfsFile.touch(@fs + pwd + '/' + filename, mtime: mtime)
421
+ end
422
+
423
+ case filename[/^\w+(?=:\/\/)/]
424
+ when 'dfs'
425
+ DfsFile.touch filename, mtime: mtime
426
+ #when 'ftp'
427
+ # MyMediaFTP.touch filename
428
+ else
429
+ FileUtils.touch filename, mtime: mtime
389
430
  end
390
431
 
391
432
  end
data.tar.gz.sig CHANGED
@@ -1,5 +1 @@
1
- lë�?_��h/�K0�[�,���x��«ML;&�#F��ދj?��C2v"�;�L�ë�ۭ��^��k)cp���y�']fq�A�����oը��`�A2�k�1A Sf^.�vE�HwC��{�db=jZ���KJ.��IA��/i{���R kfG0Q�<��_x.JR�x-k̭j��A���w7vBF@�C��|�d��L�&
2
- �R�=��Q�Og�[8�IIx�]��݋gVh>^ � P��گE�b�� f�"EE��1�hWg�3
3
- �6���ڡZ @M
4
- h=����n��/�ͮ����>���K�_^ݡ �$�wޗ���9x��R���_d�� ��Xw* �OD��C�
5
- W��J�ϋ���XT��\���
1
+ &��vY2t˵r��Rֈ)p!D����/Jӹ/��< I��7�,&6�A�� Z)~�wp��4�^[��~�g>Q0>7�@=�Z:��@>����?q=l�D,ۆ��R���R{7HZ�QDُ����6�v*�b�����%�8ٰ�l p���^8a;Yej� w�F�k h���8v�+,���wʓ�.��U��B_39�⥄۱"��h����@Ƴ�t��d ��b�yʏ��E+�B���#����4Rc�9ڹ�ʺ��pW�`�BD����Fԟmh&Ϻ�f���p����Afd��@��ؘ��=��i�mπh���ĎnC���Q��H���z<�T��`������f��{3(S"��)y�2�
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.2.1
4
+ version: 1.2.5
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-25 00:00:00.000000000 Z
38
+ date: 2022-02-08 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: rsc
metadata.gz.sig CHANGED
Binary file