drb_reg_client 0.1.0 → 0.2.0

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
- SHA1:
3
- metadata.gz: 3179364ce3e178c8f7f4d7ef895f2100b17684a5
4
- data.tar.gz: 8a22304a8ef1df652d9f59beeb934b6f8ab7aae9
2
+ SHA256:
3
+ metadata.gz: 630edfba92b374d8933dc085dcd98b373cc682ad95c23b891e57366a1d44b953
4
+ data.tar.gz: ecae0ef882e657b676506cc05e6b80bb0ab5bb48cdcc09cb5b5e51f36c1fc30a
5
5
  SHA512:
6
- metadata.gz: 38155a56d129934ac08199fe12d0d893c701eb538e505cb1bd246cbb3203bdd4cd29598d5c1fdd960ac5cc19e4e5d0b78372bdb19980a199dfd7f7732f0e6ca6
7
- data.tar.gz: 19c432c12fb9bfa8ead9c8d0f097231c8ec086a5906851475db3be12313f266ec240726d6f088ee565dd44f209206b62bed870839e19364ba8373ec1049ce66d
6
+ metadata.gz: dae2da72692772cdf1653037deb323c4c0751df9503f8658bea5672959b15136b052083cf6c013f3a9c1f965bb0944e823f370c18d4c78725d64d314ee527e85
7
+ data.tar.gz: ad76f8e7bef8fc7b1f3c37fe64bfbcf6f8423dc5c9dbdf8e6337dd5e10b0085066caf6b9634db9ecff78b1a173e1c1950a96be893e472b21629693f04c60e885
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -10,20 +10,61 @@ require 'rexle'
10
10
  class DRbRegClient
11
11
 
12
12
 
13
- def initialize(host: 'localhost', port: '59500')
13
+ def initialize(host: nil, port: '59500', debug: false)
14
+
15
+ @port, @debug = port, debug
14
16
  DRb.start_service
15
17
 
16
18
  # attach to the DRb server via a URI given on the command line
17
- @reg = DRbObject.new nil, "druby://#{host}:#{port}"
19
+ @reg = DRbObject.new nil, "druby://#{host}:#{port}" if host
18
20
  end
19
21
 
20
22
  def delete_key(path)
21
23
  @reg.delete_key path
24
+ end
25
+
26
+ def get(s)
27
+
28
+ raw_uri, raw_path = s[/(?<=reg:\/\/).*/].split('/',2)
29
+ host, port = raw_uri.split(':')
30
+ port ||= @port
31
+
32
+ if @debug
33
+ puts 'host:' + host.inspect
34
+ puts 'port:' + port.inspect
35
+ end
36
+
37
+ @reg = DRbObject.new nil, "druby://#{host}:#{port}"
38
+
39
+ path, raw_q = raw_path.split('?',2)
40
+
41
+ r = get_key(path, auto_detect_type: true)
42
+
43
+ if raw_q then
44
+
45
+ q = raw_q[/(?<=q\=)[^$]+/]
46
+
47
+ if q then
48
+ attr_val = r.attributes[q.to_sym]
49
+ Time.parse(attr_val) if q.to_sym == :last_modified
50
+ end
51
+
52
+ else
53
+
54
+ return r
55
+
56
+ end
57
+
58
+
59
+
22
60
  end
23
61
 
24
62
  def get_key(key='', auto_detect_type: false)
25
-
26
- r = @reg.get_key(key, auto_detect_type: auto_detect_type)
63
+
64
+ puts 'inside get_key' if @debug
65
+ r = @reg.get_key(key)
66
+
67
+ puts 'r: ' + r.inspect if @debug
27
68
 
28
69
  return unless r
29
70
 
@@ -59,15 +100,30 @@ class DRbRegClient
59
100
  end
60
101
 
61
102
 
62
- def get_keys(path)
103
+ def get_keys(key)
104
+
63
105
  recordset = @reg.get_keys(key)
106
+ return unless recordset
64
107
 
65
- if recordset then
66
- recordset.to_doc(root: 'recordset').root.xml
67
- else
68
- nil
69
- end
108
+ doc = Rexle.new(recordset)
109
+ doc.root.elements ? doc.root.elements.to_a : []
110
+
111
+ end
112
+
113
+ def import(s)
114
+ @reg.import s
70
115
  end
116
+
117
+ def set(s, value)
118
+
119
+ raw_uri, path = s[/(?<=reg:\/\/).*/].split('/',2)
120
+ host, port = raw_uri.split(':')
121
+ port ||= @port
122
+
123
+ @reg = DRbObject.new nil, "druby://#{host}:#{port}"
124
+ set_key(path, value)
125
+
126
+ end
71
127
 
72
128
  def set_key(key, value)
73
129
 
@@ -84,13 +140,8 @@ class DRbRegClient
84
140
 
85
141
  return [] if r.empty?
86
142
 
87
- doc = Rexle.new(r)
88
-
89
- if doc.root.elements then
90
- doc.root.elements.to_a
91
- else
92
- []
93
- end
143
+ doc = Rexle.new(r)
144
+ doc.root.elements ? doc.root.elements.to_a : []
94
145
  end
95
146
 
96
147
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drb_reg_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -10,28 +10,32 @@ bindir: bin
10
10
  cert_chain:
11
11
  - |
12
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
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TXJ8ToIk7zuFB7wu7K3L9gLHolnbnZ6fZOLsmhHuOAXue
36
+ w7VTDsV1LRF3S+/km8Tt5tpO
33
37
  -----END CERTIFICATE-----
34
- date: 2017-01-02 00:00:00.000000000 Z
38
+ date: 2020-09-02 00:00:00.000000000 Z
35
39
  dependencies:
36
40
  - !ruby/object:Gem::Dependency
37
41
  name: rexle
@@ -39,20 +43,20 @@ dependencies:
39
43
  requirements:
40
44
  - - "~>"
41
45
  - !ruby/object:Gem::Version
42
- version: '1.4'
46
+ version: '1.5'
43
47
  - - ">="
44
48
  - !ruby/object:Gem::Version
45
- version: 1.4.3
49
+ version: 1.5.8
46
50
  type: :runtime
47
51
  prerelease: false
48
52
  version_requirements: !ruby/object:Gem::Requirement
49
53
  requirements:
50
54
  - - "~>"
51
55
  - !ruby/object:Gem::Version
52
- version: '1.4'
56
+ version: '1.5'
53
57
  - - ">="
54
58
  - !ruby/object:Gem::Version
55
- version: 1.4.3
59
+ version: 1.5.8
56
60
  description:
57
61
  email: james@jamesrobertson.eu
58
62
  executables: []
@@ -79,8 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
83
  - !ruby/object:Gem::Version
80
84
  version: '0'
81
85
  requirements: []
82
- rubyforge_project:
83
- rubygems_version: 2.6.8
86
+ rubygems_version: 3.0.3
84
87
  signing_key:
85
88
  specification_version: 4
86
89
  summary: Provides a DWS_registry service using DRb; Requires a drb_reg_server to be
metadata.gz.sig CHANGED
@@ -1,4 +1,2 @@
1
- ���ch��O'k%�0;����Or:}"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�����}�_��.�*���
1
+ $�"3"hs����b��TcuM����T��!�Xҝ@�]h{�5����[Qc�+6a�8K}��uO#1��EI)QP�d%q�/���J�k���e�JR��i�֫:ooM� �qc�Τ�����S�� ��
2
+ R���(J~x�Lմp_S�omé&:�t�Ms