rxfhelper 1.2.0 → 1.2.4

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: 0b5bce02c273b620b22c57b8192108217b65dbf4c217aa9e364df125a460b110
4
- data.tar.gz: 24b8c9d64daf26dce1892ae54cfd2922de66550102656ef7094af606914fbc5e
3
+ metadata.gz: 0b78603e8153b7dea1846f2eb4d0ea043f57b57482884427b6aace2084bbaf3e
4
+ data.tar.gz: 587c9eaacf707615a39dbad35b2710e90a1ca4210e9b9ec0fa10ccaddb32f23c
5
5
  SHA512:
6
- metadata.gz: 61441bfad8795084bccf21f8ff5f18b79d3b9800712ee1b25559edb4b6c5b260d708fd211f0c18c3f2976e7ad8cefc55b39cd960ad18c027552d791bf63b3c88
7
- data.tar.gz: 85499a15be83ef2094c9fa75252b6cae89a2bc4c0c9ac3ea10ce9214a140646f87338b4c239c30bf51c2bff5e3bb3032a82102be232c3c49021f24264ca5e720
6
+ metadata.gz: 1dda34bd5be25db3997aad0e216c16f96de4634079d595b58a0856b64d731040e51aae82eaa159b43f27980170dcb99244ca3a90e487141e1963858a54f458d7
7
+ data.tar.gz: 40e54dc7853bd4bbe6745ede8dd815aa8eb5f2f41be39f265d4e47ee1a9cdf55664abf8ea30deb86325487b2f2c1b408842f873053f7ffdc025fc02e4b8c99f3
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,11 @@ 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
+
114
+ def self.touch(s, mtime: Time.now)
115
+ RXFHelper.touch(s, mtime: mtime)
116
+ end
117
+
112
118
  def self.write(x, s) RXFHelper.write(x, s) end
113
119
  def self.zip(s, a) RXFHelper.zip(s, a) end
114
120
 
@@ -153,7 +159,7 @@ class RXFHelper
153
159
  return unless permissions.is_a? Integer
154
160
  return unless s.is_a? String
155
161
 
156
- if s[/^dfs:\/\//] or @fs == :dfs then
162
+ if s[/^dfs:\/\//] or @fs[0..2] == 'dfs' then
157
163
  DfsFile.chmod permissions, s
158
164
  else
159
165
  FileUtils.chmod permissions, s
@@ -161,17 +167,20 @@ class RXFHelper
161
167
 
162
168
  end
163
169
 
164
- def self.cp(s1, s2)
170
+ def self.cp(s1, s2, debug: false)
171
+
172
+ puts 'inside RXFHelper.cp' if debug
165
173
 
166
174
  found = [s1,s2].grep /^\w+:\/\//
175
+ puts 'found: ' + found.inspect if debug
167
176
 
168
- if found then
177
+ if found.any? then
169
178
 
170
- case found.first[/^\w+(?=:\/\/)/].to_sym
179
+ case found.first[/^\w+(?=:\/\/)/]
171
180
 
172
- when :dfs
181
+ when 'dfs'
173
182
  DfsFile.cp(s1, s2)
174
- when :ftp
183
+ when 'ftp'
175
184
  MyMediaFTP.cp s1, s2
176
185
  else
177
186
 
@@ -186,12 +195,22 @@ class RXFHelper
186
195
 
187
196
  def self.chdir(x)
188
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
+
189
203
  if x[/^file:\/\//] or File.exists?(File.dirname(x)) then
204
+
190
205
  @fs = :local
191
206
  FileUtils.chdir x
207
+
192
208
  elsif x[/^dfs:\/\//]
193
- @fs = :dfs
209
+
210
+ host = x[/(?<=dfs:\/\/)[^\/]+/]
211
+ @fs = 'dfs://' + host
194
212
  DfsFile.chdir x
213
+
195
214
  end
196
215
 
197
216
  end
@@ -229,12 +248,12 @@ class RXFHelper
229
248
 
230
249
  return Dir[x] if File.exists?(File.dirname(x))
231
250
 
232
- case x[/^\w+(?=:\/\/)/].to_sym
233
- when :file
251
+ case x[/^\w+(?=:\/\/)/]
252
+ when 'file'
234
253
  Dir[x]
235
- when :dfs
254
+ when 'dfs'
236
255
  DfsFile.ls x
237
- when :ftp
256
+ when 'ftp'
238
257
  MyMediaFTP.ls x
239
258
  else
240
259
 
@@ -254,7 +273,7 @@ class RXFHelper
254
273
 
255
274
  def self.mkdir_p(x)
256
275
 
257
- if x[/^dfs:\/\//] or @fs == :dfs then
276
+ if x[/^dfs:\/\//] or @fs[0..2] == 'dfs' then
258
277
  DfsFile.mkdir_p x
259
278
  else
260
279
  FileUtils.mkdir_p x
@@ -378,13 +397,30 @@ class RXFHelper
378
397
 
379
398
  def self.rm(filename)
380
399
 
381
- case filename[/^\w+(?=:\/\/)/].to_sym
382
- when :dfs
400
+ case filename[/^\w+(?=:\/\/)/]
401
+ when 'dfs'
383
402
  DfsFile.rm filename
384
- when :ftp
403
+ when 'ftp'
385
404
  MyMediaFTP.rm filename
386
405
  else
406
+ FileUtils.rm
407
+ end
408
+
409
+ end
387
410
 
411
+ def self.touch(filename, mtime: Time.now)
412
+
413
+ if @fs[0..2] == 'dfs' then
414
+ return DfsFile.touch(@fs + pwd + '/' + filename, mtime: mtime)
415
+ end
416
+
417
+ case filename[/^\w+(?=:\/\/)/]
418
+ when 'dfs'
419
+ DfsFile.touch filename, mtime: mtime
420
+ #when 'ftp'
421
+ # MyMediaFTP.touch filename
422
+ else
423
+ FileUtils.touch filename, mtime: mtime
388
424
  end
389
425
 
390
426
  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.0
4
+ version: 1.2.4
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-24 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