drb_fileclient-reader 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b797dddda2374d573b8b603c02dfe803c7ee53dfcfb19cc08d42f3b9eed37e3a
4
+ data.tar.gz: 37509d00836c959bd30e03f43b7d79b9576c8d8c061063d1faf44d4fa6f0afe3
5
+ SHA512:
6
+ metadata.gz: 5537d2d6d397592be2e472e1140ace64e70ad4ef6a1f08c226dad60803301ad684a5fe0373a5cab89649a3df6a64b3c7014be2c556d10eb4f24440866c9a86a5
7
+ data.tar.gz: 63a0dd507a3d19b8988312475d621ea28a66a027ec1503a74ecb3e44ebdd09a63c62c04ca341c1c1916c0884490ebd3e632d237cdc71d2bf9a7662059afa0bbe
checksums.yaml.gz.sig ADDED
Binary file
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: drb_fileclient-reader.rb
4
+
5
+ require 'drb'
6
+ require 'c32'
7
+
8
+
9
+ class DRbFileClientReader
10
+ using ColouredText
11
+
12
+ def initialize(location=nil, host: nil, port: '61010', debug: false)
13
+
14
+ @debug = debug
15
+
16
+ if location then
17
+
18
+ host = location[/(?<=^dfs:\/\/)[^\/:]+/]
19
+ port = location[/(?<=^dfs:\/\/)[^:]+:(\d+)/,1] || '61010'
20
+ @directory = location[/(?<=^dfs:\/\/)[^\/]+\/(.*)/,1]
21
+
22
+ end
23
+
24
+ DRb.start_service
25
+
26
+ end
27
+
28
+ def exists?(filename=@filename)
29
+
30
+ return File.exists? filename unless @directory or filename =~ /^dfs:\/\//
31
+
32
+ if filename =~ /^dfs:\/\// then
33
+ @file, filename2 = parse_path(filename)
34
+ else
35
+
36
+ filename2 = File.join(@directory, filename)
37
+ end
38
+
39
+ @file.exists?(filename2)
40
+
41
+ end
42
+
43
+ alias exist? exists?
44
+
45
+ def read(filename=@filename)
46
+
47
+ return File.read filename, s unless @directory or filename =~ /^dfs:\/\//
48
+
49
+ if filename =~ /^dfs:\/\// then
50
+ @file, path = parse_path(filename)
51
+ else
52
+ path = File.join(@directory, filename)
53
+ end
54
+
55
+ @file.read path
56
+ end
57
+
58
+ protected
59
+
60
+ def parse_path(filename)
61
+
62
+ host = filename[/(?<=^dfs:\/\/)[^\/:]+/]
63
+ @host = host if host
64
+
65
+ port = filename[/(?<=^dfs:\/\/)[^:]+:(\d+)/,1] || '61010'
66
+
67
+ file_server = DRbObject.new nil, "druby://#{host || @host}:#{port}"
68
+ [file_server, filename[/(?<=^dfs:\/\/)[^\/]+\/(.*)/,1], ("dfs://%s:%s" % [host, port])]
69
+
70
+ end
71
+
72
+ end
73
+
74
+ class DfsFile
75
+
76
+ @client = DRbFileClientReader.new
77
+
78
+ def self.exists?(filename) @client.exists?(filename) end
79
+ def self.read(filename) @client.read(filename) end
80
+
81
+ end
82
+
data.tar.gz.sig ADDED
Binary file
metadata ADDED
@@ -0,0 +1,90 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: drb_fileclient-reader
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - James Robertson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
14
+ YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMjIwMjIxMjM0OTIwWhcN
15
+ MjMwMjIxMjM0OTIwWjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
16
+ cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQCubcUm
17
+ 91H+TX0i82RsG/0ZykJ1S+96n7tIa8WJkrsW5TFzYvMYyHLZrFD+Yx4vkmLiEVst
18
+ MuLPMC39d1YXcpakHofockmjO9vIAnZrdDLRKrmHCZYO/N2H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j6Ybn/ziJCSZOlV/nGtjfZmJbAlrOKqD7Hn6M1MlrL8Z24b6pRJDNOL0
35
+ im+YlEcJfPax42Av6oEBmm6oUqxICcrKX8DdDuNFC44LAC66kmOdMTNiVdeS82BG
36
+ CGf+32hX61V/Gw6Jiazh7a6L
37
+ -----END CERTIFICATE-----
38
+ date: 2022-02-21 00:00:00.000000000 Z
39
+ dependencies:
40
+ - !ruby/object:Gem::Dependency
41
+ name: c32
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '0.3'
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: 0.3.0
50
+ type: :runtime
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - "~>"
55
+ - !ruby/object:Gem::Version
56
+ version: '0.3'
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: 0.3.0
60
+ description:
61
+ email: digital.robertson@gmail.com
62
+ executables: []
63
+ extensions: []
64
+ extra_rdoc_files: []
65
+ files:
66
+ - lib/drb_fileclient-reader.rb
67
+ homepage: https://github.com/jrobertson/drb_fileclient-reader
68
+ licenses:
69
+ - MIT
70
+ metadata: {}
71
+ post_install_message:
72
+ rdoc_options: []
73
+ require_paths:
74
+ - lib
75
+ required_ruby_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ requirements: []
86
+ rubygems_version: 3.2.22
87
+ signing_key:
88
+ specification_version: 4
89
+ summary: A DRb file reader client to access the DRb_fileserver service.
90
+ test_files: []
metadata.gz.sig ADDED
Binary file