drb_fileclient-reader 0.1.6 → 0.1.8
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 +1 -80
- data.tar.gz.sig +0 -0
- metadata +3 -3
- 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: c9410a7898afe8a74312baf93ec46b2820856f6fe9440835e4c77d203fad4bce
|
4
|
+
data.tar.gz: 8203ae4e5c60e2eb48c8d3d743f5bb08c7837ce0255aa48a8e080b520e7aa8aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9dc14a72dd41c645f0c905ecb64cddb1b5548a3dcbd833de8530707b6864f851a450d2eca780312ea0f118be5cf501835711a8d4d2b40b94093b76341c528bfe
|
7
|
+
data.tar.gz: 430fc33bdab44ba1244bd13468f6e3d4b0e303f8e27b8eed2c4bf00ff28bd8cce9c0df38bd284a94e1452140e62843c7184d876b2e254440edc32e8875d02385
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -2,87 +2,8 @@
|
|
2
2
|
|
3
3
|
# file: drb_fileclient-reader.rb
|
4
4
|
|
5
|
-
require 'drb'
|
6
|
-
require 'c32'
|
7
5
|
|
6
|
+
# testing, please ignore this version
|
8
7
|
|
9
8
|
class DRbFileClientReader
|
10
|
-
using ColouredText
|
11
|
-
|
12
|
-
def initialize(location=nil, host: nil, port: '61010', debug: false)
|
13
|
-
|
14
|
-
@debug = debug
|
15
|
-
@@file ||= nil
|
16
|
-
|
17
|
-
if location then
|
18
|
-
|
19
|
-
host = location[/(?<=^dfs:\/\/)[^\/:]+/]
|
20
|
-
port = location[/(?<=^dfs:\/\/)[^:]+:(\d+)/,1] || '61010'
|
21
|
-
@@directory ||= location[/(?<=^dfs:\/\/)[^\/]+\/(.*)/,1]
|
22
|
-
else
|
23
|
-
@@directory ||= nil
|
24
|
-
end
|
25
|
-
|
26
|
-
DRb.start_service
|
27
|
-
|
28
|
-
end
|
29
|
-
|
30
|
-
def exist?(filename=@@filename)
|
31
|
-
|
32
|
-
return File.exist? filename unless @@directory or filename =~ /^dfs:\/\//
|
33
|
-
|
34
|
-
if filename =~ /^dfs:\/\// then
|
35
|
-
|
36
|
-
file, filename2 = parse_path(filename)
|
37
|
-
@@file ||= file
|
38
|
-
|
39
|
-
else
|
40
|
-
|
41
|
-
filename2 = File.join(@@directory, filename)
|
42
|
-
end
|
43
|
-
|
44
|
-
@@file.exist?(filename2)
|
45
|
-
|
46
|
-
end
|
47
|
-
|
48
|
-
alias exist? exists?
|
49
|
-
|
50
|
-
def read(filename=@@filename)
|
51
|
-
|
52
|
-
return File.read(filename) unless @@directory or filename =~ /^dfs:\/\//
|
53
|
-
|
54
|
-
if filename =~ /^dfs:\/\// then
|
55
|
-
file, path = parse_path(filename)
|
56
|
-
@@file ||= file
|
57
|
-
else
|
58
|
-
path = File.join(@@directory, filename)
|
59
|
-
end
|
60
|
-
|
61
|
-
@@file.read path
|
62
|
-
end
|
63
|
-
|
64
|
-
protected
|
65
|
-
|
66
|
-
def parse_path(filename)
|
67
|
-
|
68
|
-
host = filename[/(?<=^dfs:\/\/)[^\/:]+/]
|
69
|
-
@host = host if host
|
70
|
-
|
71
|
-
port = filename[/(?<=^dfs:\/\/)[^:]+:(\d+)/,1] || '61010'
|
72
|
-
|
73
|
-
file_server = DRbObject.new nil, "druby://#{host || @host}:#{port}"
|
74
|
-
[file_server, filename[/(?<=^dfs:\/\/)[^\/]+\/(.*)/,1], ("dfs://%s:%s" % [host, port])]
|
75
|
-
|
76
|
-
end
|
77
|
-
|
78
|
-
end
|
79
|
-
|
80
|
-
class DfsFile
|
81
|
-
|
82
|
-
@client = DRbFileClientReader.new
|
83
|
-
|
84
|
-
def self.exist?(filename) @client.exist?(filename) end
|
85
|
-
def self.exists?(filename) @client.exist?(filename) end
|
86
|
-
def self.read(filename) @client.read(filename) end
|
87
|
-
|
88
9
|
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.8
|
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: 2023-01-
|
38
|
+
date: 2023-01-18 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: c32
|
@@ -83,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
83
|
- !ruby/object:Gem::Version
|
84
84
|
version: '0'
|
85
85
|
requirements: []
|
86
|
-
rubygems_version: 3.4.
|
86
|
+
rubygems_version: 3.4.4
|
87
87
|
signing_key:
|
88
88
|
specification_version: 4
|
89
89
|
summary: A DRb file reader client to access the DRb_fileserver service.
|
metadata.gz.sig
CHANGED
Binary file
|