drb_reg_client 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
+ SHA1:
3
+ metadata.gz: 3179364ce3e178c8f7f4d7ef895f2100b17684a5
4
+ data.tar.gz: 8a22304a8ef1df652d9f59beeb934b6f8ab7aae9
5
+ SHA512:
6
+ metadata.gz: 38155a56d129934ac08199fe12d0d893c701eb538e505cb1bd246cbb3203bdd4cd29598d5c1fdd960ac5cc19e4e5d0b78372bdb19980a199dfd7f7732f0e6ca6
7
+ data.tar.gz: 19c432c12fb9bfa8ead9c8d0f097231c8ec086a5906851475db3be12313f266ec240726d6f088ee565dd44f209206b62bed870839e19364ba8373ec1049ce66d
checksums.yaml.gz.sig ADDED
Binary file
@@ -0,0 +1,96 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: drb_reg_client.rb
4
+
5
+ require 'drb'
6
+ require 'json'
7
+ require 'rexle'
8
+
9
+
10
+ class DRbRegClient
11
+
12
+
13
+ def initialize(host: 'localhost', port: '59500')
14
+ DRb.start_service
15
+
16
+ # attach to the DRb server via a URI given on the command line
17
+ @reg = DRbObject.new nil, "druby://#{host}:#{port}"
18
+ end
19
+
20
+ def delete_key(path)
21
+ @reg.delete_key path
22
+ end
23
+
24
+ def get_key(key='', auto_detect_type: false)
25
+
26
+ r = @reg.get_key(key, auto_detect_type: auto_detect_type)
27
+
28
+ return unless r
29
+
30
+ doc = Rexle.new(r)
31
+ e = doc.root
32
+
33
+ return e unless auto_detect_type
34
+
35
+ c = e.attributes[:type]
36
+ s = e.text
37
+
38
+ return e if e.elements.length > 0 or s.nil?
39
+ return s unless c
40
+
41
+ h = {
42
+ string: ->(x) {x},
43
+ boolean: ->(x){
44
+ case x
45
+ when 'true' then true
46
+ when 'false' then false
47
+ when 'on' then true
48
+ when 'off' then false
49
+ else x
50
+ end
51
+ },
52
+ number: ->(x){ x[/^[0-9]+$/] ? x.to_i : x.to_f },
53
+ time: ->(x) {Time.parse x},
54
+ json: ->(x) {JSON.parse x}
55
+ }
56
+
57
+ h[c.to_sym].call s
58
+
59
+ end
60
+
61
+
62
+ def get_keys(path)
63
+ recordset = @reg.get_keys(key)
64
+
65
+ if recordset then
66
+ recordset.to_doc(root: 'recordset').root.xml
67
+ else
68
+ nil
69
+ end
70
+ end
71
+
72
+ def set_key(key, value)
73
+
74
+ r = @reg.set_key(key, value)
75
+ return unless r
76
+
77
+ doc = Rexle.new(r)
78
+ doc.root
79
+ end
80
+
81
+ def xpath(path)
82
+
83
+ r = @reg.xpath path
84
+
85
+ return [] if r.empty?
86
+
87
+ doc = Rexle.new(r)
88
+
89
+ if doc.root.elements then
90
+ doc.root.elements.to_a
91
+ else
92
+ []
93
+ end
94
+ end
95
+
96
+ end
data.tar.gz.sig ADDED
Binary file
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: drb_reg_client
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
+ MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
+ YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
+ 8ixkARkWAmV1MB4XDTE3MDEwMTIzNTIzMFoXDTE4MDEwMTIzNTIzMFowSDESMBAG
16
+ A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
+ EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
+ ggEBAJiYL33oFY3yHPjGqsHcYx8SMP5MZ5ofrbn+5cAy3dzYrwfHWWuUOidiIc2d
19
+ COXrECjbsjK71e0DGrXF8KwCMB8yvnMs9f9ZsLauqCJYmsOC5a5BpKrfusyT822Z
20
+ Vj8AfD40mGXGkACUyCf+DfzeV85PoPx5O2ifVKEof2dqFJcR5IC2aRf8NjFTt/tb
21
+ FY3Too3p0PMS5VxknC2pxodSds50FPQGbjvTjaDxLA4v+7Qc3WioiLXnFz4HKDl1
22
+ ymb0jv3Bv/ggd6dX4rfqGTnQFP9UdnrXOEfvDm7MkmkqK1KHc7jsLO+cLkl74xN0
23
+ V5tUJ48mwUUGQa1crtwwX7HQyZECAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
24
+ DwQEAwIEsDAdBgNVHQ4EFgQUmwgUdWY/UO3mOMKc7OeLlY+MjCAwJgYDVR0RBB8w
25
+ HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
26
+ c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAEt3pARVB
27
+ QxWV1wD45ZiaPQ46UG0OA4KRjtaO6iKjxAaeGYHjNQTTkyQnT60bZcc5/AcCXWdx
28
+ +xlwJcYiUF9MC8g2bs0+GZwf6czh7oAKAUbp80+0yZumAP+ULC7Sc7Pj/DjnONJE
29
+ UepYof6huyT/JFuPYorab+7C0Sf/jl25wlP/+FydBrOAXo9VZ3HXqIIHbRgk9FPa
30
+ 6xNi/Vp49cIxbZrOGZs9JEOMUAdC3nXXvhna9JqC+8Wt8IDebuQPY8CMSDhWjN4S
31
+ uHj2eBqfHY4PcCqvdEK5KiWLRGfIHWWdXuLCSlP/7rCqqY5MVo48Yc6GyhMmxVwn
32
+ 6iB5Pe+6lC+zjg==
33
+ -----END CERTIFICATE-----
34
+ date: 2017-01-02 00:00:00.000000000 Z
35
+ dependencies:
36
+ - !ruby/object:Gem::Dependency
37
+ name: rexle
38
+ requirement: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: '1.4'
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 1.4.3
46
+ type: :runtime
47
+ prerelease: false
48
+ version_requirements: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: '1.4'
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 1.4.3
56
+ description:
57
+ email: james@jamesrobertson.eu
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - lib/drb_reg_client.rb
63
+ homepage: https://github.com/jrobertson/drb_reg_client
64
+ licenses:
65
+ - MIT
66
+ metadata: {}
67
+ post_install_message:
68
+ rdoc_options: []
69
+ require_paths:
70
+ - lib
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ requirements: []
82
+ rubyforge_project:
83
+ rubygems_version: 2.6.8
84
+ signing_key:
85
+ specification_version: 4
86
+ summary: Provides a DWS_registry service using DRb; Requires a drb_reg_server to be
87
+ running.
88
+ test_files: []
metadata.gz.sig ADDED
@@ -0,0 +1,4 @@
1
+ ���ch��O'k%�0;����O�r:}"95�����u�W��
2
+ ��߰(��v�Ұ[���F�^���N�&�
3
+ J$�U<S���+�&9R.�Uqų��
4
+ m�g�ڳe>�\L�NFe��&��+�^����O'bhP͚���6��gqP1����(:���n0L�qo����x�A��U�M�r�����K�L�ޯ���'�<D=t�b���o�=X>�ܟ(��Gt�I��.M�����}�_��.�*���