drb_fileclient 0.7.3 → 0.8.0

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: d66acaefb595fe166f98c929cf925bc68481c16704e755fede8678154febd362
4
- data.tar.gz: 559b0980b0351348caa2637918e397b8f6cdbe4545549ce67c2740fac56f825f
3
+ metadata.gz: 3ed719651fa7f16cafe56ad1b31e5dc38e2b5f4911efc02ea3debbf000fe979f
4
+ data.tar.gz: e7f3cedea649ef656a2a3bbac1bbea1c5b08d4361a8dbba6e8e6c053daba6cea
5
5
  SHA512:
6
- metadata.gz: a3f9bddb2678b221a0fe668d849f4baf5cc2524c0335ced4310478fee4122fdf33e8985f3fb812edebf6f144d1f69b8d2c6a0096282fb9322db4f36c8700afa0
7
- data.tar.gz: a68b5f2219c1003f67e5d9829a917e761cc2f9ef300fae11e3221d3ea2ffed9226e40082f07a77f62ac9f610f3cfc0a1cbc8b5585e840a6bd63b26205a642e9b
6
+ metadata.gz: 8e58ed59bb066e970725a2c78e7f53541eba9dd78502583fe460353a60e2ea1ceead178426fb5f062a763fb96663395274f9318551576cd6d01d09692268a1a6
7
+ data.tar.gz: 7f9dea8306afeb58826bf9c0ca791d41770dc566a1409ff8df7d7c2d564aee3904ddb2404c75580bf99d29ed28226ad2bd996f63c1793b3d7770ee7d772332f8
checksums.yaml.gz.sig CHANGED
Binary file
@@ -2,33 +2,14 @@
2
2
 
3
3
  # file: drb_fileclient.rb
4
4
 
5
- require 'drb'
6
5
  require 'zip'
7
- require 'c32'
8
- # Commented out to avoid bug with RXFHelper constants
9
- #require 'dir-to-xml'
6
+ require 'dir-to-xml'
7
+ require 'drb_fileclient-readwrite'
10
8
 
11
9
 
12
-
13
- class DRbFileClient
10
+ class DRbFileClient < DRbFileClientReadWrite
14
11
  using ColouredText
15
12
 
16
- def initialize(location=nil, host: nil, port: '61010', debug: false)
17
-
18
- @debug = debug
19
-
20
- if location then
21
-
22
- host = location[/(?<=^dfs:\/\/)[^\/:]+/]
23
- port = location[/(?<=^dfs:\/\/)[^:]+:(\d+)/,1] || '61010'
24
- @directory = location[/(?<=^dfs:\/\/)[^\/]+\/(.*)/,1]
25
-
26
- end
27
-
28
- DRb.start_service
29
-
30
- end
31
-
32
13
  def chdir(raw_path)
33
14
 
34
15
  return Dir.chdir raw_path unless @directory or raw_path =~ /^dfs:\/\//
@@ -132,35 +113,6 @@ class DRbFileClient
132
113
 
133
114
  end
134
115
 
135
- def exists?(filename=@filename)
136
-
137
- return File.exists? filename unless @directory or filename =~ /^dfs:\/\//
138
-
139
- if filename =~ /^dfs:\/\// then
140
- @file, filename2 = parse_path(filename)
141
- else
142
-
143
- filename2 = File.join(@directory, filename)
144
- end
145
-
146
- @file.exists?(filename2)
147
-
148
- end
149
-
150
- alias exist? exists?
151
-
152
- def glob(s)
153
-
154
- if s =~ /^dfs:\/\// then
155
- @file, s2 = parse_path(s)
156
- else
157
- s2 = File.join(@directory, s)
158
- end
159
-
160
- @file.glob s2
161
-
162
- end
163
-
164
116
  def ls(raw_path)
165
117
 
166
118
  return Dir[raw_path] unless @directory or raw_path =~ /^dfs:\/\//
@@ -177,29 +129,6 @@ class DRbFileClient
177
129
 
178
130
  end
179
131
 
180
- def mkdir(name)
181
-
182
- return FileUtils.mkdir name unless @directory or name =~ /^dfs:\/\//
183
-
184
- @file, path = parse_path(name)
185
- @file.mkdir path
186
- end
187
-
188
- def mkdir_p(raw_path)
189
-
190
- unless @directory or raw_path =~ /^dfs:\/\// then
191
- return FileUtils.mkdir_p raw_path
192
- end
193
-
194
- if raw_path =~ /^dfs:\/\// then
195
- @file, filepath = parse_path(raw_path)
196
- else
197
- filepath = File.join(@directory, raw_path)
198
- end
199
-
200
- @file.mkdir_p filepath
201
- end
202
-
203
132
  def mv(raw_path, raw_path2)
204
133
 
205
134
  unless @directory or raw_path =~ /^dfs:\/\// then
@@ -229,49 +158,6 @@ class DRbFileClient
229
158
 
230
159
  end
231
160
 
232
- def read(filename=@filename)
233
-
234
- return File.read filename, s unless @directory or filename =~ /^dfs:\/\//
235
-
236
- if filename =~ /^dfs:\/\// then
237
- @file, path = parse_path(filename)
238
- else
239
- path = File.join(@directory, filename)
240
- end
241
-
242
- @file.read path
243
- end
244
-
245
- def rm(path)
246
-
247
- return FileUtils.rm path unless @directory or path =~ /^dfs:\/\//
248
-
249
- if path =~ /^dfs:\/\// then
250
- @file, path2 = parse_path( path)
251
- else
252
- path2 = File.join(@directory, path)
253
- end
254
-
255
- @file.rm path2
256
-
257
- end
258
-
259
- def rm_r(path, force: false)
260
-
261
- unless @directory or path =~ /^dfs:\/\// then
262
- return FileUtils.rm_r(path, force: force)
263
- end
264
-
265
- if path =~ /^dfs:\/\// then
266
- @file, path2 = parse_path( path)
267
- else
268
- path2 = File.join(@directory, path)
269
- end
270
-
271
- @file.rm_r(path2, force: force)
272
-
273
- end
274
-
275
161
  def ru(path)
276
162
 
277
163
  return DirToXML.new(path, verbose: false).latest unless @directory \
@@ -305,36 +191,6 @@ class DRbFileClient
305
191
 
306
192
  end
307
193
 
308
- def touch(s, mtime: Time.now)
309
-
310
- unless @directory or s =~ /^dfs:\/\// then
311
- return FileUtils.touch(s, mtime: mtime)
312
- end
313
-
314
- if s =~ /^dfs:\/\// then
315
- @file, s2 = parse_path(s)
316
- else
317
- s2 = File.join(@directory, s)
318
- end
319
-
320
- @file.touch s2, mtime: mtime
321
-
322
- end
323
-
324
- def write(filename=@filename, s)
325
-
326
- return File.write filename, s unless @directory or filename =~ /^dfs:\/\//
327
-
328
- if filename =~ /^dfs:\/\// then
329
- @file, path = parse_path(filename)
330
- else
331
- path = File.join(@directory, filename)
332
- end
333
-
334
- @file.write path, s
335
-
336
- end
337
-
338
194
  def zip(filename_zip, a)
339
195
 
340
196
  puts '@directory: ' + @directory.inspect if @debug
@@ -361,52 +217,36 @@ class DRbFileClient
361
217
 
362
218
  end
363
219
 
364
- private
365
-
366
- def parse_path(filename)
367
-
368
- host = filename[/(?<=^dfs:\/\/)[^\/:]+/]
369
- @host = host if host
370
-
371
- port = filename[/(?<=^dfs:\/\/)[^:]+:(\d+)/,1] || '61010'
372
-
373
- file_server = DRbObject.new nil, "druby://#{host || @host}:#{port}"
374
- [file_server, filename[/(?<=^dfs:\/\/)[^\/]+\/(.*)/,1], ("dfs://%s:%s" % [host, port])]
375
-
376
- end
377
-
378
220
  end
379
221
 
380
- class DfsFile
381
-
382
- @client = DRbFileClient.new
383
-
384
- def self.directory?(filename) @client.directory?(filename) end
385
- def self.exists?(filename) @client.exists?(filename) end
386
- def self.chdir(path) @client.chdir(path) end
387
- def self.chmod(num, filename) @client.chmod(num, filename) end
388
- def self.cp(path, path2) @client.cp(path, path2) end
389
- def self.glob(s) @client.glob(s) end
390
- def self.ls(path) @client.ls(path) end
391
- def self.mkdir(name) @client.mkdir(name) end
392
- def self.mkdir_p(path) @client.mkdir_p(path) end
393
- def self.mv(path, path2) @client.mv(path, path2) end
394
- def self.pwd() @client.pwd() end
395
- def self.read(filename) @client.read(filename) end
396
- def self.rm(filename) @client.rm(filename) end
397
-
398
- def self.rm_r(filename, force: false)
399
- @client.rm_r(filename, force: force)
400
- end
401
-
402
- def self.ru(path) @client.ru(path) end
403
- def self.ru_r(path) @client.ru_r(path) end
404
-
405
- def self.touch(filename, mtime: Time.now)
406
- @client.touch(filename, mtime: mtime)
407
- end
408
-
409
- def self.write(filename, s) @client.write(filename, s) end
410
- def self.zip(filename, a) @client.zip(filename, a) end
411
222
 
223
+ def DfsFile.directory?(filename)
224
+ DRbFileClient.new.directory?(filename)
225
+ end
226
+ def DfsFile.chdir(path)
227
+ DRbFileClient.new.chdir(path)
228
+ end
229
+ def DfsFile.chmod(num, filename)
230
+ DRbFileClient.new.chmod(num, filename)
231
+ end
232
+ def DfsFile.cp(path, path2)
233
+ DRbFileClient.new.cp(path, path2)
234
+ end
235
+ def DfsFile.ls(path)
236
+ DRbFileClient.new.ls(path)
237
+ end
238
+ def DfsFile.mv(path, path2)
239
+ DRbFileClient.new.mv(path, path2)
240
+ end
241
+ def DfsFile.pwd()
242
+ DRbFileClient.new.pwd()
243
+ end
244
+ def DfsFile.ru(path)
245
+ DRbFileClient.new.ru(path)
246
+ end
247
+ def DfsFile.ru_r(path)
248
+ DRbFileClient.new.ru_r(path)
249
+ end
250
+ def DfsFile.zip(filename, a)
251
+ DRbFileClient.new.zip(filename, a)
412
252
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drb_fileclient
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.3
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,7 +35,7 @@ cert_chain:
35
35
  FGcgjmmz5fOIqq2sBxk6JW1yo2G43yIUzymWOYKT2Jh6RR0Gg3z66wWwYpFpx8yR
36
36
  00JTBNVAgW+s2sLpeBtyMDbb
37
37
  -----END CERTIFICATE-----
38
- date: 2022-02-15 00:00:00.000000000 Z
38
+ date: 2022-02-22 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: zip
@@ -58,25 +58,45 @@ dependencies:
58
58
  - !ruby/object:Gem::Version
59
59
  version: 2.0.2
60
60
  - !ruby/object:Gem::Dependency
61
- name: c32
61
+ name: dir-to-xml
62
62
  requirement: !ruby/object:Gem::Requirement
63
63
  requirements:
64
64
  - - "~>"
65
65
  - !ruby/object:Gem::Version
66
- version: '0.3'
66
+ version: '1.2'
67
67
  - - ">="
68
68
  - !ruby/object:Gem::Version
69
- version: 0.3.0
69
+ version: 1.2.1
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.3'
76
+ version: '1.2'
77
77
  - - ">="
78
78
  - !ruby/object:Gem::Version
79
- version: 0.3.0
79
+ version: 1.2.1
80
+ - !ruby/object:Gem::Dependency
81
+ name: drb_fileclient-readwrite
82
+ requirement: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - "~>"
85
+ - !ruby/object:Gem::Version
86
+ version: '0.1'
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: 0.1.0
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.1'
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: 0.1.0
80
100
  description:
81
101
  email: digital.robertson@gmail.com
82
102
  executables: []
metadata.gz.sig CHANGED
Binary file