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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: '069e451b1e7939b6dbb5c23bc67a9537b1aa83d5'
4
- data.tar.gz: 872db0d50b802c0b70cda63db6fb19fe0e5b58b6
3
+ metadata.gz: dd42ee37f23b6f28962588e4dfa95dc0ef8e4005
4
+ data.tar.gz: 6b1cdd9efeef6bdbe3dec07560b8f0166131c4f6
5
5
  SHA512:
6
- metadata.gz: 483d6cf8d7b7d7a68806f7cd2eae04a454c16e6e04e8ec332c18e996740094bda7d38865c9f1e810aa6f69c96562f089260e7b00a3c50a72a839a9ca41cd9713
7
- data.tar.gz: '0928ec6d8e035f3110c780c33f653d2b1e9d78d9ef5104832cabd7f5380e1fefafacea807921e593905686f51dbb65b0ce87a6e37461e12124fceb6c3430cffe'
6
+ metadata.gz: 8320a5af00cba74b7b80c81bcb923f5fca71f52edff4d1ca39dfb26c99b3a2fee455b2715a0843e0908a1e9640bed6d424196c60fd8d6a11862ddb0bd83e4a80
7
+ data.tar.gz: db432841ae94d179afbc39b595f6140a829311f709a24ef2f542b8980a586eff805cae24f965b81fa47dfa742011a03c64bec28bd7bcbf1736887b27999f5cf2
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -7,28 +7,50 @@ require 'drb'
7
7
 
8
8
  class DRbFileClient
9
9
 
10
- def initialize(host: 'localhost', port: '61010')
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.exists? filename
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.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-02-24 00:00:00.000000000 Z
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