onedrb 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: eab24c21c8453a726e65959c8b47f6074d08bfee91d25860f23935b7c20831a0
4
+ data.tar.gz: c40e0aa09c94232e478c826a36df32585b17dc221c1a9ca5d860ff245f8c24b1
5
+ SHA512:
6
+ metadata.gz: 218e690d7e795f49fd2f09baa8fd86399bd0d6192cd14cce2db370657e5422066719fd18ea7cb0f1adfa7bfb5abaa4002c2b5b62be43ba3abc74cc07adb1ddbf
7
+ data.tar.gz: 5146e2915e49b03dede0d04b0ea84d426b7a5150b01d719ff65a6da0b48b857221c6dfdbb9a007146e7ae5d963f8d03485e5004db26d709806712f0f3d542dd8
Binary file
Binary file
@@ -0,0 +1,71 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: onedrb.rb
4
+
5
+ # Description: Makes it convenient to make an object remotely accessible.
6
+
7
+ require 'drb'
8
+ require 'c32'
9
+
10
+
11
+ class OneDrbError < Exception
12
+ end
13
+
14
+
15
+ module OneDrb
16
+
17
+ class Server
18
+ using ColouredText
19
+
20
+ def initialize(host: '127.0.0.1', port: (49152..65535).to_a.sample.to_s,
21
+ obj: nil, log: nil)
22
+
23
+ log.info self.class.to_s + '/initialize: active' if log
24
+
25
+ @host, @port, @log = host, port, log
26
+
27
+ if obj then
28
+ @obj = obj
29
+ else
30
+ msg = "No object supplied!".error
31
+ puts msg
32
+ raise OneDrbError, msg
33
+ end
34
+
35
+ log.info self.class.to_s +'/initialize: completed' if log
36
+
37
+ end
38
+
39
+ def start()
40
+
41
+ @log.info self.class.to_s +'/start: active' if @log
42
+ puts (self.class.to_s + " running on port " + @port).info
43
+ DRb.start_service "druby://#{@host}:#{@port}", @obj
44
+ DRb.thread.join
45
+
46
+ end
47
+
48
+ end
49
+
50
+
51
+ class Client
52
+ using ColouredText
53
+
54
+ def initialize(host: '127.0.0.1', port: nil)
55
+
56
+ DRb.start_service
57
+
58
+ puts 'no port supplied'.error unless port
59
+
60
+ puts ('client connecting to port ' + port).info
61
+ @obj = DRbObject.new_with_uri("druby://#{host}:#{port}")
62
+
63
+ end
64
+
65
+ def method_missing(sym, *args)
66
+ @obj.send(sym, *args)
67
+ end
68
+
69
+ end
70
+
71
+ end
metadata ADDED
@@ -0,0 +1,90 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: onedrb
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
+ YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMTkwODEzMTkwMTM0WhcN
15
+ MjAwODEyMTkwMTM0WjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
16
+ cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQDwerdP
17
+ aVKeP5RVh9q4v/9L1K61jr2S4/uirJ64zby8+phkUyRSUj5qDKv3revhEqaxFg5I
18
+ ujs2zQNpwrVrNz5fl/adplygVNFF6Pa4KJq+IpnhafhRXCpCEBkmU7M+XzLVgipM
19
+ 4AHbrRG3jCxevFK7bBSqEA+/snRhcBq9gPSnIv0opaVnugfH+KaCXc8S9CEkbqfW
20
+ Xm9nf1eQ4Vr0hkL/LsXfxs3WlNL3k/m1PZ+v0wCnyPYQDJfudGGvoK3c5fF/UzEW
21
+ hRjiby6zjBw4E2NutxAwvnCMcCQ2ASFoiu+TP9CVn9c7IxIQ4vo1R+HFeibG4qR6
22
+ +eJ6Z3g5EazzjnrT8qfnuJJ/zP/JNppKZHAhDjYMzW65q+oePHLcRw/VgX0tSLpC
23
+ pMYfcbi5UJGJR01wZ1RoE07ku+aG8Ke3oslkz/bCtNB69UISaascyxauSDuFIX8n
24
+ Ft4fk8jo8Y/2bBjYgXiCVcPpA6orR342+H/WEs8T2lWoJewr5GGzn2/T280CAwEA
25
+ AaOBijCBhzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUTQ8/qr6P
26
+ uacX1pIgbur6QRY1HTUwJgYDVR0RBB8wHYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0
27
+ c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1hc3RlckBqYW1lc3JvYmVydHNvbi5ldTAN
28
+ BgkqhkiG9w0BAQsFAAOCAYEAnb2fmshYrAcUHgEUdqetowCWZJxJ9zzR8xslCAX4
29
+ zeJKOgOVgGWcoUUgsDotW5hK2pafZj8fU749CbaCTj1QqT6d4D22gKtP0TNzQ4/e
30
+ JLXwO40Ot4px4D4dSN318G8y6uoPv/4ArlbccXlIOlcddS2fYWSRfLQCqhWFMYj4
31
+ 0wpw6Zjjmrb5PlF0hMDvm3Te2JgebdnAXG4I0IJkuMdMFIbDG+q65WpsMug4CpLu
32
+ DZT2BYXoaz72J9wLcN7BqLsOP7uL6GnaswpM4BUaq9sZWXS/B47KNE0PAZy4IT20
33
+ 0n3EApJpibKRBZJR/L4WsuxyekLleMmVgWXS1bqgJUsmSIbUcjB+atazO/mx1beT
34
+ cu8vU4iTC0XJWbLmzTZt9FH9tbulje2nlE+Pt4MjVWAZivWRkXlRsfy8YFytzLZg
35
+ FbeYaP5rMZ9xxTvO5hDjh3BEOwHK9GXxMPsakyl7b4sUHJKEw5wtyjkYsMwrJmj9
36
+ XkF/ReqRKodw4HNu5DG4wj6O
37
+ -----END CERTIFICATE-----
38
+ date: 2019-08-13 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.2.0
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '0.2'
50
+ type: :runtime
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: 0.2.0
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '0.2'
60
+ description:
61
+ email: james@jamesrobertson.eu
62
+ executables: []
63
+ extensions: []
64
+ extra_rdoc_files: []
65
+ files:
66
+ - lib/onedrb.rb
67
+ homepage: https://github.com/jrobertson/onedrb
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.0.1
87
+ signing_key:
88
+ specification_version: 4
89
+ summary: Makes it convenient to make an object remotely accessible.
90
+ test_files: []
Binary file