boutons 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/boutons.rb +18 -6
- data/lib/boutons/config.rb +8 -3
- data/lib/boutons/version.rb +1 -1
- metadata +1 -2
- data/lib/boutons/early_start.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4eedf75f5b88e6bc0015378dd9cccd4e32123183
|
4
|
+
data.tar.gz: 576fb18f8c227b183c8c104c6aca06a97b7ca8b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a2ff48868a766cd4ee4d7725b9f118f37badd575a3eb60294452e07fe792d5b0e63a4ef18fb6391ea6aba0de92304332bb44699ecd127c783c4f0ebbe6531da
|
7
|
+
data.tar.gz: 400f48bfd41954399837c022f5ed11c8e59c5c12a03f16f33e102662c89e4c15fcd617186e858f70da05c0a6f79df1984e1ceff474b168ad679bdaf52a6d9013
|
data/lib/boutons.rb
CHANGED
@@ -104,18 +104,30 @@ module Boutons
|
|
104
104
|
def normalize name
|
105
105
|
name.to_s.gsub(/\./,"_").to_sym
|
106
106
|
end
|
107
|
-
def
|
107
|
+
def service_from_config name
|
108
|
+
return if @@mapping[name]
|
109
|
+
return unless Boutons::Config.services.zookeeper.keys.include? name
|
110
|
+
params = Boutons::Config.discovery.zookeeper rescue {}
|
111
|
+
params[:application] = name
|
112
|
+
params[:path] = Boutons::Config.services.zookeeper.send(name)
|
113
|
+
Boutons.add Synapse::Easy::Service.new params
|
114
|
+
end
|
115
|
+
def resolv_service method, *args, &block
|
116
|
+
service_from_config method
|
108
117
|
name = @@mapping[method]
|
109
118
|
unless name
|
110
119
|
return @@services.send(method, *args, &block) if @@services.respond_to? method
|
111
|
-
raise SynapseNotFound.new("The Synapse #{method}
|
120
|
+
raise SynapseNotFound.new("The Synapse #{method} is unavailable. Add service #{method} first.") unless name
|
112
121
|
end
|
113
122
|
synapse = @@services[name]
|
114
|
-
|
123
|
+
unless synapse
|
124
|
+
raise SynapseNotFound.new("The Synapse #{method} is unavailable. Add service #{method} first.")
|
125
|
+
end
|
115
126
|
return synapse if args.empty?
|
116
127
|
synapse.send(args[0],*args,&block)
|
117
128
|
end
|
129
|
+
def method_missing method, *args, &block
|
130
|
+
resolv_service method, *args, &block
|
131
|
+
end
|
118
132
|
end
|
119
|
-
end
|
120
|
-
|
121
|
-
require "boutons/early_start"
|
133
|
+
end
|
data/lib/boutons/config.rb
CHANGED
@@ -9,12 +9,17 @@ module Boutons
|
|
9
9
|
return file if File.exists? file
|
10
10
|
end
|
11
11
|
end
|
12
|
+
def use
|
13
|
+
services.zookeeper.each do |service,path|
|
14
|
+
Boutons.add Synapse::Easy::Service.new application: service, path: path, hosts: (discovery.zookeeper.hosts rescue nil)
|
15
|
+
end rescue nil
|
16
|
+
end
|
12
17
|
private
|
13
|
-
def config
|
14
|
-
@config ||= self.new TOML.load_file(file,symbolize_keys:true)
|
18
|
+
def config params={}
|
19
|
+
@config ||= self.new TOML.load_file(file,symbolize_keys:true).deep_merge(params)
|
15
20
|
end
|
16
21
|
def method_missing method, *args, &block
|
17
|
-
config.send
|
22
|
+
config.send(method, *args, &block) rescue nil
|
18
23
|
end
|
19
24
|
end
|
20
25
|
def keys
|
data/lib/boutons/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: boutons
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mathias Kaufmann
|
@@ -154,7 +154,6 @@ files:
|
|
154
154
|
- boutons.gemspec
|
155
155
|
- lib/boutons.rb
|
156
156
|
- lib/boutons/config.rb
|
157
|
-
- lib/boutons/early_start.rb
|
158
157
|
- lib/boutons/synapse.rb
|
159
158
|
- lib/boutons/version.rb
|
160
159
|
homepage: https://synapse.stei.gr/boutons
|
data/lib/boutons/early_start.rb
DELETED