drb_fileclient 0.1.1 → 0.1.2
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.tar.gz.sig +0 -0
- data/lib/drb_fileclient.rb +29 -7
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd42ee37f23b6f28962588e4dfa95dc0ef8e4005
|
4
|
+
data.tar.gz: 6b1cdd9efeef6bdbe3dec07560b8f0166131c4f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8320a5af00cba74b7b80c81bcb923f5fca71f52edff4d1ca39dfb26c99b3a2fee455b2715a0843e0908a1e9640bed6d424196c60fd8d6a11862ddb0bd83e4a80
|
7
|
+
data.tar.gz: db432841ae94d179afbc39b595f6140a829311f709a24ef2f542b8980a586eff805cae24f965b81fa47dfa742011a03c64bec28bd7bcbf1736887b27999f5cf2
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/drb_fileclient.rb
CHANGED
@@ -7,28 +7,50 @@ require 'drb'
|
|
7
7
|
|
8
8
|
class DRbFileClient
|
9
9
|
|
10
|
-
def initialize(host:
|
10
|
+
def initialize(location=nil, host: nil, port: '61010')
|
11
|
+
|
12
|
+
if location then
|
13
|
+
|
14
|
+
host = location[/(?<=^dfs:\/\/)[^\/:]+/]
|
15
|
+
port = location[/(?<=^dfs:\/\/)[^:]+:(\d+)/,1] || '61010'
|
16
|
+
@filename = location[/(?<=^dfs:\/\/)[^\/]+\/(.*)/,1]
|
17
|
+
|
18
|
+
end
|
11
19
|
|
12
20
|
DRb.start_service
|
13
21
|
|
14
22
|
# attach to the DRb server via a URI given on the command line
|
15
|
-
@file = DRbObject.new nil, "druby://#{host}:#{port}"
|
23
|
+
@file = DRbObject.new nil, "druby://#{host}:#{port}" if host
|
16
24
|
|
17
25
|
end
|
18
26
|
|
19
|
-
def exists?(filename)
|
20
|
-
|
21
|
-
@file
|
27
|
+
def exists?(filename=@filename)
|
28
|
+
|
29
|
+
filename2 = if @file then
|
30
|
+
|
31
|
+
filename
|
32
|
+
|
33
|
+
else
|
34
|
+
|
35
|
+
host = filename[/(?<=^dfs:\/\/)[^\/:]+/]
|
36
|
+
port = filename[/(?<=^dfs:\/\/)[^:]+:(\d+)/,1] || '61010'
|
37
|
+
|
38
|
+
@file = DRbObject.new nil, "druby://#{host}:#{port}"
|
39
|
+
filename[/(?<=^dfs:\/\/)[^\/]+\/(.*)/,1]
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
@file.exists? filename2
|
22
44
|
|
23
45
|
end
|
24
46
|
|
25
|
-
def read(filename)
|
47
|
+
def read(filename=@filename)
|
26
48
|
|
27
49
|
@file.read filename
|
28
50
|
|
29
51
|
end
|
30
52
|
|
31
|
-
def write(filename, s)
|
53
|
+
def write(filename=@filename, s)
|
32
54
|
|
33
55
|
@file.write filename, s
|
34
56
|
|
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.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
2aIZ9lf6/AT4LP07t9jB5oYLHlr2nBLIqtPXdJvg5RKKr79CQVmpJ5LCTjwTg9h+
|
31
31
|
g1Q=
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2018-
|
33
|
+
date: 2018-05-25 00:00:00.000000000 Z
|
34
34
|
dependencies: []
|
35
35
|
description:
|
36
36
|
email: james@jamesrobertson.eu
|
metadata.gz.sig
CHANGED
Binary file
|