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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: df3695db6a49667960edd6677455a28c49d6c803
4
- data.tar.gz: 3113a43cbd378bf35dcaf5e5640e1e5605c5ca55
3
+ metadata.gz: e7742e8a1fcec586fb33ee44414d89ea7ecee87f
4
+ data.tar.gz: c9d97cf47d41a5e9b2b22a464b78d3311da7471e
5
5
  SHA512:
6
- metadata.gz: 0766be8fdd83373ed5a38a137b953cbcdfa7b0c2d882e5430a9788bd1249df82947f9566c97ea75889a220fd25aa5c2c5d8b0fa93f1c1b7d49a8596912253ca4
7
- data.tar.gz: eacc4ce1b574080c81371277c422a678e5e0ad0db3ce43813ef0cad6809f36a9e74613499397d3bbe189bebbf1d6a49616c85e49ac71a15ca66045bc59832e55
6
+ metadata.gz: 7430044a5e2f07f3a3ef65a4a98561579b0904ae7e842bf686162da33195dd5ab67004a8f4a70c392f48dce721d7a63175e4ce0cc3555f3cf1ddfc81e2343e1c
7
+ data.tar.gz: 15c8870993c265004ad98696f9812915e3d7af01a9605ee447354db3efe85598fbf29fa0730c5a5a52192c5f4647ff9e9589399816d4bd3d0851a0fc78b9b073
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## App-rb 0.4.0 (April 8, 2017) ##
2
+
3
+ * [breaking change] Remove node role support.
4
+ * Support array for `name` in `constraint`.
5
+
1
6
  ## App-rb 0.3.0 (March 29, 2017) ##
2
7
 
3
8
  * Add debug info in `Registry#tags_list`
@@ -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| n.name == constraint["name"] }
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, :roles)
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"], (n["Meta"] || {})["roles"].to_s.split(",").reject{ |s| s.to_s.empty? })
32
+ Node.new(n["Node"], n["Address"])
36
33
  }
37
34
  end
38
35
  end
@@ -1,3 +1,3 @@
1
1
  module AppRb
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
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.3.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-03-29 00:00:00.000000000 Z
11
+ date: 2017-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler