drb_fileclient-reader 0.1.0 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/drb_fileclient-reader.rb +34 -34
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ba32fab7b6cbe1adeb3e5f8e81a200baa6c4252b5e9baf94ecd21b64137cc8a
|
4
|
+
data.tar.gz: 584af5bfc10500b5c5f84335bf563e2f2bc9b6f78bcad58388f2591068673efb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d6335a539b05b53bf5523d260bd9418e48e7836d9de702179f1bece7921e93389072a809ccaf0ce5996cd2cb4d9066d7836e7872731c3fc98ff60b4a50c2086
|
7
|
+
data.tar.gz: 4f075865e34157b5a1214fbac8e863aa968d602206b07d5e93c4aaa838039c958ed03eab42fb23852acc41e8d2017a3118d25e87a9ecf8d10c045856345ad39c
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -10,58 +10,59 @@ class DRbFileClientReader
|
|
10
10
|
using ColouredText
|
11
11
|
|
12
12
|
def initialize(location=nil, host: nil, port: '61010', debug: false)
|
13
|
-
|
13
|
+
|
14
14
|
@debug = debug
|
15
|
-
|
15
|
+
|
16
16
|
if location then
|
17
|
-
|
17
|
+
|
18
18
|
host = location[/(?<=^dfs:\/\/)[^\/:]+/]
|
19
19
|
port = location[/(?<=^dfs:\/\/)[^:]+:(\d+)/,1] || '61010'
|
20
|
-
|
21
|
-
|
20
|
+
@@directory ||= location[/(?<=^dfs:\/\/)[^\/]+\/(.*)/,1]
|
21
|
+
else
|
22
|
+
@@directory ||= nil
|
22
23
|
end
|
23
|
-
|
24
|
+
|
24
25
|
DRb.start_service
|
25
|
-
|
26
|
+
|
26
27
|
end
|
27
|
-
|
28
|
-
def exists?(filename
|
29
|
-
|
30
|
-
return File.exists? filename unless
|
31
|
-
|
28
|
+
|
29
|
+
def exists?(filename=@@filename)
|
30
|
+
|
31
|
+
return File.exists? filename unless @@directory or filename =~ /^dfs:\/\//
|
32
|
+
|
32
33
|
if filename =~ /^dfs:\/\// then
|
33
|
-
|
34
|
+
@@file, filename2 = parse_path(filename)
|
34
35
|
else
|
35
36
|
|
36
|
-
filename2 = File.join(
|
37
|
+
filename2 = File.join(@@directory, filename)
|
37
38
|
end
|
38
39
|
|
39
|
-
|
40
|
-
|
40
|
+
@@file.exists?(filename2)
|
41
|
+
|
41
42
|
end
|
42
|
-
|
43
|
+
|
43
44
|
alias exist? exists?
|
44
45
|
|
45
|
-
def read(filename
|
46
|
-
|
47
|
-
return File.read
|
48
|
-
|
46
|
+
def read(filename=@@filename)
|
47
|
+
|
48
|
+
return File.read(filename) unless @@directory or filename =~ /^dfs:\/\//
|
49
|
+
|
49
50
|
if filename =~ /^dfs:\/\// then
|
50
|
-
|
51
|
+
@@file, path = parse_path(filename)
|
51
52
|
else
|
52
|
-
path = File.join(
|
53
|
+
path = File.join(@@directory, filename)
|
53
54
|
end
|
54
|
-
|
55
|
-
|
55
|
+
|
56
|
+
@@file.read path
|
56
57
|
end
|
57
|
-
|
58
|
+
|
58
59
|
protected
|
59
|
-
|
60
|
+
|
60
61
|
def parse_path(filename)
|
61
62
|
|
62
63
|
host = filename[/(?<=^dfs:\/\/)[^\/:]+/]
|
63
64
|
@host = host if host
|
64
|
-
|
65
|
+
|
65
66
|
port = filename[/(?<=^dfs:\/\/)[^:]+:(\d+)/,1] || '61010'
|
66
67
|
|
67
68
|
file_server = DRbObject.new nil, "druby://#{host || @host}:#{port}"
|
@@ -69,14 +70,13 @@ class DRbFileClientReader
|
|
69
70
|
|
70
71
|
end
|
71
72
|
|
72
|
-
end
|
73
|
+
end
|
73
74
|
|
74
75
|
class DfsFile
|
75
|
-
|
76
|
+
|
76
77
|
@client = DRbFileClientReader.new
|
77
|
-
|
78
|
-
def self.exists?(filename) @client.exists?(filename) end
|
78
|
+
|
79
|
+
def self.exists?(filename) @client.exists?(filename) end
|
79
80
|
def self.read(filename) @client.read(filename) end
|
80
|
-
|
81
|
-
end
|
82
81
|
|
82
|
+
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-reader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
im+YlEcJfPax42Av6oEBmm6oUqxICcrKX8DdDuNFC44LAC66kmOdMTNiVdeS82BG
|
36
36
|
CGf+32hX61V/Gw6Jiazh7a6L
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2022-02-
|
38
|
+
date: 2022-02-24 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: c32
|
metadata.gz.sig
CHANGED
Binary file
|