drb_fileclient 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ebfe11659555afdd1a5b938d65dbf555710785308077f46040275f6416fa407a
4
- data.tar.gz: 749c9c2c1dc888fe6cf7faa5ff7163454887edf2f2fdf26ba9b8a7ec47a65275
3
+ metadata.gz: 3ed719651fa7f16cafe56ad1b31e5dc38e2b5f4911efc02ea3debbf000fe979f
4
+ data.tar.gz: e7f3cedea649ef656a2a3bbac1bbea1c5b08d4361a8dbba6e8e6c053daba6cea
5
5
  SHA512:
6
- metadata.gz: 2ad6ed6c1a5b71271904c308df9ba30a9165b13777066afbf03d4dbba222f4b7b8c82a96d639156996a09d103efa7cf6401d8c51083e36e2a9d31c6b9e019c65
7
- data.tar.gz: 03b607d56913a234a7e51ee91ecf6592aa3e366b545367bda920fa77ebe0413da9e5adf320789c0dd1f5687b6fe337c8422643d70c8beca6dd9d4e04ed69a5f4
6
+ metadata.gz: 8e58ed59bb066e970725a2c78e7f53541eba9dd78502583fe460353a60e2ea1ceead178426fb5f062a763fb96663395274f9318551576cd6d01d09692268a1a6
7
+ data.tar.gz: 7f9dea8306afeb58826bf9c0ca791d41770dc566a1409ff8df7d7c2d564aee3904ddb2404c75580bf99d29ed28226ad2bd996f63c1793b3d7770ee7d772332f8
checksums.yaml.gz.sig CHANGED
Binary file
@@ -2,31 +2,14 @@
2
2
 
3
3
  # file: drb_fileclient.rb
4
4
 
5
- require 'drb'
6
5
  require 'zip'
7
- require 'c32'
8
6
  require 'dir-to-xml'
7
+ require 'drb_fileclient-readwrite'
9
8
 
10
9
 
11
- class DRbFileClient
10
+ class DRbFileClient < DRbFileClientReadWrite
12
11
  using ColouredText
13
12
 
14
- def initialize(location=nil, host: nil, port: '61010', debug: false)
15
-
16
- @debug = debug
17
-
18
- if location then
19
-
20
- host = location[/(?<=^dfs:\/\/)[^\/:]+/]
21
- port = location[/(?<=^dfs:\/\/)[^:]+:(\d+)/,1] || '61010'
22
- @directory = location[/(?<=^dfs:\/\/)[^\/]+\/(.*)/,1]
23
-
24
- end
25
-
26
- DRb.start_service
27
-
28
- end
29
-
30
13
  def chdir(raw_path)
31
14
 
32
15
  return Dir.chdir raw_path unless @directory or raw_path =~ /^dfs:\/\//
@@ -130,35 +113,6 @@ class DRbFileClient
130
113
 
131
114
  end
132
115
 
133
- def exists?(filename=@filename)
134
-
135
- return File.exists? filename unless @directory or filename =~ /^dfs:\/\//
136
-
137
- if filename =~ /^dfs:\/\// then
138
- @file, filename2 = parse_path(filename)
139
- else
140
-
141
- filename2 = File.join(@directory, filename)
142
- end
143
-
144
- @file.exists?(filename2)
145
-
146
- end
147
-
148
- alias exist? exists?
149
-
150
- def glob(s)
151
-
152
- if s =~ /^dfs:\/\// then
153
- @file, s2 = parse_path(s)
154
- else
155
- s2 = File.join(@directory, s)
156
- end
157
-
158
- @file.glob s2
159
-
160
- end
161
-
162
116
  def ls(raw_path)
163
117
 
164
118
  return Dir[raw_path] unless @directory or raw_path =~ /^dfs:\/\//
@@ -175,29 +129,6 @@ class DRbFileClient
175
129
 
176
130
  end
177
131
 
178
- def mkdir(name)
179
-
180
- return FileUtils.mkdir name unless @directory or name =~ /^dfs:\/\//
181
-
182
- @file, path = parse_path(name)
183
- @file.mkdir path
184
- end
185
-
186
- def mkdir_p(raw_path)
187
-
188
- unless @directory or raw_path =~ /^dfs:\/\// then
189
- return FileUtils.mkdir_p raw_path
190
- end
191
-
192
- if raw_path =~ /^dfs:\/\// then
193
- @file, filepath = parse_path(raw_path)
194
- else
195
- filepath = File.join(@directory, raw_path)
196
- end
197
-
198
- @file.mkdir_p filepath
199
- end
200
-
201
132
  def mv(raw_path, raw_path2)
202
133
 
203
134
  unless @directory or raw_path =~ /^dfs:\/\// then
@@ -227,61 +158,19 @@ class DRbFileClient
227
158
 
228
159
  end
229
160
 
230
- def read(filename=@filename)
231
-
232
- return File.read filename, s unless @directory or filename =~ /^dfs:\/\//
233
-
234
- if filename =~ /^dfs:\/\// then
235
- @file, path = parse_path(filename)
236
- else
237
- path = File.join(@directory, filename)
238
- end
239
-
240
- @file.read path
241
- end
242
-
243
- def rm(path)
244
-
245
- return FileUtils.rm path unless @directory or path =~ /^dfs:\/\//
246
-
247
- if path =~ /^dfs:\/\// then
248
- @file, path2 = parse_path( path)
249
- else
250
- path2 = File.join(@directory, path)
251
- end
252
-
253
- @file.rm path2
254
-
255
- end
256
-
257
- def rm_r(path, force: false)
258
-
259
- unless @directory or path =~ /^dfs:\/\// then
260
- return FileUtils.rm_r(path, force: force)
261
- end
262
-
263
- if path =~ /^dfs:\/\// then
264
- @file, path2 = parse_path( path)
265
- else
266
- path2 = File.join(@directory, path)
267
- end
268
-
269
- @file.rm_r(path2, force: force)
270
-
271
- end
272
-
273
161
  def ru(path)
274
162
 
275
163
  return DirToXML.new(path, verbose: false).latest unless @directory \
276
164
  or path =~ /^dfs:\/\//
277
165
 
278
166
  if path =~ /^dfs:\/\// then
279
- @file, path2 = parse_path( path)
167
+ @file, path2, addr = parse_path(path)
280
168
  else
281
169
  path2 = File.join(@directory, path)
282
170
  end
283
171
 
284
- @file.ru path2
172
+ found = @file.ru path2
173
+ return (addr + found) if found and addr
285
174
 
286
175
  end
287
176
 
@@ -292,42 +181,13 @@ class DRbFileClient
292
181
  end
293
182
 
294
183
  if path =~ /^dfs:\/\// then
295
- @file, path2 = parse_path( path)
184
+ @file, path2, addr = parse_path(path)
296
185
  else
297
186
  path2 = File.join(@directory, path)
298
187
  end
299
188
 
300
- @file.ru_r path2
301
-
302
- end
303
-
304
- def touch(s, mtime: Time.now)
305
-
306
- unless @directory or s =~ /^dfs:\/\// then
307
- return FileUtils.touch(s, mtime: mtime)
308
- end
309
-
310
- if s =~ /^dfs:\/\// then
311
- @file, s2 = parse_path(s)
312
- else
313
- s2 = File.join(@directory, s)
314
- end
315
-
316
- @file.touch s2, mtime: mtime
317
-
318
- end
319
-
320
- def write(filename=@filename, s)
321
-
322
- return File.write filename, s unless @directory or filename =~ /^dfs:\/\//
323
-
324
- if filename =~ /^dfs:\/\// then
325
- @file, path = parse_path(filename)
326
- else
327
- path = File.join(@directory, filename)
328
- end
329
-
330
- @file.write path, s
189
+ found = @file.ru_r path2
190
+ return (addr + found) if found and addr
331
191
 
332
192
  end
333
193
 
@@ -357,52 +217,36 @@ class DRbFileClient
357
217
 
358
218
  end
359
219
 
360
- private
361
-
362
- def parse_path(filename)
363
-
364
- host = filename[/(?<=^dfs:\/\/)[^\/:]+/]
365
- @host = host if host
366
-
367
- port = filename[/(?<=^dfs:\/\/)[^:]+:(\d+)/,1] || '61010'
368
-
369
- file_server = DRbObject.new nil, "druby://#{host || @host}:#{port}"
370
- [file_server, filename[/(?<=^dfs:\/\/)[^\/]+\/(.*)/,1]]
371
-
372
- end
373
-
374
220
  end
375
221
 
376
- class DfsFile
377
-
378
- @client = DRbFileClient.new
379
-
380
- def self.directory?(filename) @client.directory?(filename) end
381
- def self.exists?(filename) @client.exists?(filename) end
382
- def self.chdir(path) @client.chdir(path) end
383
- def self.chmod(num, filename) @client.chmod(num, filename) end
384
- def self.cp(path, path2) @client.cp(path, path2) end
385
- def self.glob(s) @client.glob(s) end
386
- def self.ls(path) @client.ls(path) end
387
- def self.mkdir(name) @client.mkdir(name) end
388
- def self.mkdir_p(path) @client.mkdir_p(path) end
389
- def self.mv(path, path2) @client.mv(path, path2) end
390
- def self.pwd() @client.pwd() end
391
- def self.read(filename) @client.read(filename) end
392
- def self.rm(filename) @client.rm(filename) end
393
-
394
- def self.rm_r(filename, force: false)
395
- @client.rm_r(filename, force: force)
396
- end
397
-
398
- def self.ru(path) @client.ru(path) end
399
- def self.ru_r(path) @client.ru_r(path) end
400
-
401
- def self.touch(filename, mtime: Time.now)
402
- @client.touch(filename, mtime: mtime)
403
- end
404
-
405
- def self.write(filename, s) @client.write(filename, s) end
406
- def self.zip(filename, a) @client.zip(filename, a) end
407
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)
408
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.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,68 +35,68 @@ cert_chain:
35
35
  FGcgjmmz5fOIqq2sBxk6JW1yo2G43yIUzymWOYKT2Jh6RR0Gg3z66wWwYpFpx8yR
36
36
  00JTBNVAgW+s2sLpeBtyMDbb
37
37
  -----END CERTIFICATE-----
38
- date: 2022-02-10 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
- name: dir-to-xml
41
+ name: zip
42
42
  requirement: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '1.1'
46
+ version: '2.0'
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: 1.1.2
49
+ version: 2.0.2
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - "~>"
55
55
  - !ruby/object:Gem::Version
56
- version: '1.1'
56
+ version: '2.0'
57
57
  - - ">="
58
58
  - !ruby/object:Gem::Version
59
- version: 1.1.2
59
+ version: 2.0.2
60
60
  - !ruby/object:Gem::Dependency
61
- name: zip
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: '2.0'
66
+ version: '1.2'
67
67
  - - ">="
68
68
  - !ruby/object:Gem::Version
69
- version: 2.0.2
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: '2.0'
76
+ version: '1.2'
77
77
  - - ">="
78
78
  - !ruby/object:Gem::Version
79
- version: 2.0.2
79
+ version: 1.2.1
80
80
  - !ruby/object:Gem::Dependency
81
- name: c32
81
+ name: drb_fileclient-readwrite
82
82
  requirement: !ruby/object:Gem::Requirement
83
83
  requirements:
84
- - - ">="
85
- - !ruby/object:Gem::Version
86
- version: 0.3.0
87
84
  - - "~>"
88
85
  - !ruby/object:Gem::Version
89
- version: '0.3'
86
+ version: '0.1'
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: 0.1.0
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: 0.3.0
97
94
  - - "~>"
98
95
  - !ruby/object:Gem::Version
99
- version: '0.3'
96
+ version: '0.1'
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: 0.1.0
100
100
  description:
101
101
  email: digital.robertson@gmail.com
102
102
  executables: []
@@ -123,8 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  requirements: []
126
- rubyforge_project:
127
- rubygems_version: 2.7.10
126
+ rubygems_version: 3.2.22
128
127
  signing_key:
129
128
  specification_version: 4
130
129
  summary: Reads or writes files from a remote DRb server. Simple as DfsFile.read or
metadata.gz.sig CHANGED
Binary file