boutons 0.3.5 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/boutons/uri.rb +22 -12
- data/lib/boutons/version.rb +1 -1
- data/lib/boutons.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51727c2ed0f15675876579d355fdf01aa2edbae0
|
4
|
+
data.tar.gz: ddd212a3a02675be8aad3e7853924c1fb691dd89
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0271103992aa33d3f24b40a3ba5e4f8d8d8ce1a6ef227a6ad3fc0ba188e5192f74d86ad43f19bdbdec600b9e6d09b8fa8ec2f0fd9af614f0a30c4be54f20285d
|
7
|
+
data.tar.gz: 2402112f0f91ad4aa9f176dcb6fda1570e8b8a314a72d74cd858841cc3e117510fd57112a4a89a3079b2da56997aa8f2cc4ba82faeff1036686d50ad70495f2e
|
data/lib/boutons/uri.rb
CHANGED
@@ -10,8 +10,26 @@ module Boutons
|
|
10
10
|
def service
|
11
11
|
@uri.scheme
|
12
12
|
end
|
13
|
+
|
13
14
|
def zk_hosts
|
14
|
-
|
15
|
+
@hosts = []
|
16
|
+
if @uri.host
|
17
|
+
if ::URI.unescape(@uri.host)=~/\{(.*)\}/
|
18
|
+
uris = ::URI.unescape(@uri.host).split(",").select do |x|
|
19
|
+
x=~/\{(.*)\}/
|
20
|
+
end.collect do |x|
|
21
|
+
URI "#{@uri.scheme}://#{x[1..-2].reverse.sub(';',':').reverse}/"
|
22
|
+
end
|
23
|
+
uris.each do |uri|
|
24
|
+
@hosts << "#{uri.host}:#{uri.port || 2181 }"
|
25
|
+
end
|
26
|
+
else
|
27
|
+
@hosts << "#{@uri.host}:#{@uri.port || 2181 }"
|
28
|
+
end
|
29
|
+
else
|
30
|
+
@hosts = Config.registry.send(service).hosts
|
31
|
+
end
|
32
|
+
@hosts
|
15
33
|
end
|
16
34
|
def zk
|
17
35
|
begin
|
@@ -46,20 +64,12 @@ module Boutons
|
|
46
64
|
end
|
47
65
|
end
|
48
66
|
def zk_path
|
49
|
-
|
50
|
-
paths = []
|
51
|
-
paths << "nerve"
|
52
|
-
paths += @uri.path.split("/")[1..-1].join("/#{@uri.host}/").split("/")
|
53
|
-
paths << "services"
|
54
|
-
paths.inject([Pathname.new("/")]) do |path,dir|
|
55
|
-
path << path.last.join(dir)
|
56
|
-
end.map{|p|p.to_s}.reverse.each do |path|
|
57
|
-
return @zk_path = path unless zk.children(path).empty?
|
58
|
-
end
|
67
|
+
@uri.path
|
59
68
|
end
|
60
69
|
end
|
61
70
|
def initialize uri
|
62
|
-
|
71
|
+
uri = ::URI.escape uri
|
72
|
+
@uri ||= URI(uri)
|
63
73
|
end
|
64
74
|
def registry
|
65
75
|
@registry ||= Registry.new @uri
|
data/lib/boutons/version.rb
CHANGED
data/lib/boutons.rb
CHANGED
@@ -128,12 +128,12 @@ module Boutons
|
|
128
128
|
params[:method] = uri.registry.service
|
129
129
|
params[:path] = uri.registry.zk_path
|
130
130
|
params[:hosts] = uri.registry.zk_hosts
|
131
|
-
params[:name] =
|
131
|
+
params[:name] = service
|
132
132
|
add Synapse::Easy::Service.new params
|
133
133
|
end
|
134
134
|
end
|
135
135
|
def connectable? service
|
136
|
-
|
136
|
+
available.include?(service) rescue false
|
137
137
|
end
|
138
138
|
def connection service
|
139
139
|
services[mapping[service]]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: boutons
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mathias Kaufmann
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: synapse
|