app-rb 0.3.0 → 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/CHANGELOG.md +5 -0
- data/lib/app-rb/command.rb +0 -2
- data/lib/app-rb/config.rb +4 -7
- data/lib/app-rb/version.rb +1 -1
- 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: e7742e8a1fcec586fb33ee44414d89ea7ecee87f
|
4
|
+
data.tar.gz: c9d97cf47d41a5e9b2b22a464b78d3311da7471e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7430044a5e2f07f3a3ef65a4a98561579b0904ae7e842bf686162da33195dd5ab67004a8f4a70c392f48dce721d7a63175e4ce0cc3555f3cf1ddfc81e2343e1c
|
7
|
+
data.tar.gz: 15c8870993c265004ad98696f9812915e3d7af01a9605ee447354db3efe85598fbf29fa0730c5a5a52192c5f4647ff9e9589399816d4bd3d0851a0fc78b9b073
|
data/CHANGELOG.md
CHANGED
data/lib/app-rb/command.rb
CHANGED
@@ -66,7 +66,6 @@ module AppRb
|
|
66
66
|
nodes = @config.nodes.select { |n| ips.index(n.ip) }
|
67
67
|
max_name_len = nodes.map { |n| n.name.length }.max
|
68
68
|
max_ip_len = nodes.map { |n| n.ip.length }.max
|
69
|
-
max_roles_len = nodes.map { |n| n.roles.inspect.length }.max
|
70
69
|
current_base = AppRb::Util::Consul.kv_get(@config.consul, @config.app, "base")
|
71
70
|
current_hash = AppRb::Util::Consul.kv_get(@config.consul, @config.app, "hash")
|
72
71
|
current_dockers = nodes.map { |n|
|
@@ -83,7 +82,6 @@ module AppRb
|
|
83
82
|
puts(
|
84
83
|
" "*5 + n.name.rjust(max_name_len) +
|
85
84
|
" "*2 + n.ip.ljust(max_ip_len) +
|
86
|
-
" "*2 + n.roles.inspect.ljust(max_roles_len) +
|
87
85
|
" "*2 + AppRb::Util.green(current_dockers[i]) + " / " + (dockers[i] - current_dockers[i] == 0 ? "0" : AppRb::Util.red(dockers[i] - current_dockers[i]))
|
88
86
|
)
|
89
87
|
end
|
data/lib/app-rb/config.rb
CHANGED
@@ -16,23 +16,20 @@ class AppRb::Config
|
|
16
16
|
def nodes(constraint = nil)
|
17
17
|
constraint ||= {}
|
18
18
|
out = __nodes
|
19
|
-
if constraint["role"]
|
20
|
-
out = out.select { |n| n.roles.index(constraint["role"]) }
|
21
|
-
end
|
22
19
|
if constraint["name"]
|
23
|
-
out = out.select { |n|
|
20
|
+
out = out.select { |n| Array(constraint["name"]).index(n.name) }
|
24
21
|
end
|
25
|
-
out
|
22
|
+
out.shuffle
|
26
23
|
end
|
27
24
|
|
28
25
|
private
|
29
26
|
|
30
|
-
Node = Struct.new(:name, :ip
|
27
|
+
Node = Struct.new(:name, :ip)
|
31
28
|
def __nodes
|
32
29
|
@__nodes ||= JSON.load(AppRb::Util.just_cmd("curl -s #{@body["consul"]}/v1/catalog/nodes")).sort_by { |n|
|
33
30
|
n["Node"]
|
34
31
|
}.map { |n|
|
35
|
-
Node.new(n["Node"], n["Address"]
|
32
|
+
Node.new(n["Node"], n["Address"])
|
36
33
|
}
|
37
34
|
end
|
38
35
|
end
|
data/lib/app-rb/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: app-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexey Vakhov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|