rxfhelper 1.2.2 → 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: 8b138d1576463c9bba8e0d18b64e7be0734f2df074854f94fbb4f0efa109d768
4
- data.tar.gz: 8b66c19d007599ef84ba0dc2a361e92d93565625c5b1608b10c84d2abc204291
3
+ metadata.gz: 28e436ed54b4585bc6386e61934df9ef818720c3bda4948df520c44c9d0671bc
4
+ data.tar.gz: bed423faffffcee3e793eb0e2c739302a65f8e4d36241a4902c337bb07bb455f
5
5
  SHA512:
6
- metadata.gz: 75e3dc8373f2571a4222a7992c1490f9fbdfa41ceb920aeb57d12fa5f501f438991ee685316ecab6b31766a7db7d5f102e2d74c7dabb7c9406a3bf41cbbc02ab
7
- data.tar.gz: 55b81edb3b58deba0e3148cc2ce314fc45825fed75f5e79951aee77f80593b3eab82552b898fac3e334f9ff69ac5996a65da6e9d78d5cb6d38b86987be063c4b
6
+ metadata.gz: c13aa7cd67307d6b551fe77d56e326f077f47ab84f1ca1343ec60891b94545957d8d858884296d7c19118bda9d343bbad890deb97b245d58bcfc62f36e4ca74c
7
+ data.tar.gz: 8369514628a2a8993ea66fb7fb8623ed0771818df78dad09b6bc1c3ea7bfd4b7b230a39504c762d18c6aca4537f0b7af4c56499ee7c578b1445aec59d2c06e28
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/rxfhelper.rb CHANGED
@@ -110,6 +110,7 @@ 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
+ def self.touch(s) RXFHelper.touch(s) end
113
114
  def self.write(x, s) RXFHelper.write(x, s) end
114
115
  def self.zip(s, a) RXFHelper.zip(s, a) end
115
116
 
@@ -154,7 +155,7 @@ class RXFHelper
154
155
  return unless permissions.is_a? Integer
155
156
  return unless s.is_a? String
156
157
 
157
- if s[/^dfs:\/\//] or @fs == :dfs then
158
+ if s[/^dfs:\/\//] or @fs[0..2] == 'dfs' then
158
159
  DfsFile.chmod permissions, s
159
160
  else
160
161
  FileUtils.chmod permissions, s
@@ -171,11 +172,11 @@ class RXFHelper
171
172
 
172
173
  if found.any? then
173
174
 
174
- case found.first[/^\w+(?=:\/\/)/].to_sym
175
+ case found.first[/^\w+(?=:\/\/)/]
175
176
 
176
- when :dfs
177
+ when 'dfs'
177
178
  DfsFile.cp(s1, s2)
178
- when :ftp
179
+ when 'ftp'
179
180
  MyMediaFTP.cp s1, s2
180
181
  else
181
182
 
@@ -190,12 +191,22 @@ class RXFHelper
190
191
 
191
192
  def self.chdir(x)
192
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
+
193
199
  if x[/^file:\/\//] or File.exists?(File.dirname(x)) then
200
+
194
201
  @fs = :local
195
202
  FileUtils.chdir x
203
+
196
204
  elsif x[/^dfs:\/\//]
197
- @fs = :dfs
205
+
206
+ host = x[/(?<=dfs:\/\/)[^\/]+/]
207
+ @fs = 'dfs://' + host
198
208
  DfsFile.chdir x
209
+
199
210
  end
200
211
 
201
212
  end
@@ -233,12 +244,12 @@ class RXFHelper
233
244
 
234
245
  return Dir[x] if File.exists?(File.dirname(x))
235
246
 
236
- case x[/^\w+(?=:\/\/)/].to_sym
237
- when :file
247
+ case x[/^\w+(?=:\/\/)/]
248
+ when 'file'
238
249
  Dir[x]
239
- when :dfs
250
+ when 'dfs'
240
251
  DfsFile.ls x
241
- when :ftp
252
+ when 'ftp'
242
253
  MyMediaFTP.ls x
243
254
  else
244
255
 
@@ -258,7 +269,7 @@ class RXFHelper
258
269
 
259
270
  def self.mkdir_p(x)
260
271
 
261
- if x[/^dfs:\/\//] or @fs == :dfs then
272
+ if x[/^dfs:\/\//] or @fs[0..2] == 'dfs' then
262
273
  DfsFile.mkdir_p x
263
274
  else
264
275
  FileUtils.mkdir_p x
@@ -382,13 +393,30 @@ class RXFHelper
382
393
 
383
394
  def self.rm(filename)
384
395
 
385
- case filename[/^\w+(?=:\/\/)/].to_sym
386
- when :dfs
396
+ case filename[/^\w+(?=:\/\/)/]
397
+ when 'dfs'
387
398
  DfsFile.rm filename
388
- when :ftp
399
+ when 'ftp'
389
400
  MyMediaFTP.rm filename
390
401
  else
402
+ FileUtils.rm
403
+ end
391
404
 
405
+ end
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
392
420
  end
393
421
 
394
422
  end
data.tar.gz.sig CHANGED
Binary file
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.2
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-02-04 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
metadata.gz.sig CHANGED
Binary file