elastomer-cli 0.3.3 → 0.3.4

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: 64e98a9d878459f9d8477cf8451557dcbbc77aa4
4
- data.tar.gz: 25367062a2626564c53c671327cc140b6cd047fb
3
+ metadata.gz: e1fbcdfaa586df444cfc13d9fd1e5f86ec16fb3e
4
+ data.tar.gz: a2daa64a35ec3d963b593227fe8219ca6a56351e
5
5
  SHA512:
6
- metadata.gz: e37f1b581854a6d9d3551674d912ffaeef8b667dac961e684a820bb8420d996272e065ce5660cdaf9eaa218e06a7e91c0813c06a8448183880c6919a3090b081
7
- data.tar.gz: 5589afcaa5c83a5531f16d7ce4ae36e7c6038d2c7d5ea599da17ba8625caeb4ce6505c4a8020cfe6c28dc617fe3f6467b9fe17fb89f2754f2b6064ce942cf60c
6
+ metadata.gz: bccc903e4970134e2b7e99a9f25c0842a985a038075ff9a197cabf5810ab714d02ad227964e234d3a9c541dec2306c3629b32a0711940042c1bcf92de9fff0c2
7
+ data.tar.gz: 297fd892c58f723129f4698a9c577df2277850f04857e1dfbfc54d60af8661596b39f4509cc8d677d5ad505d00773a198b086f33415b9bbbfd86b8edcd6d5925
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.3.4 (2015-10-28)
2
+ - Make host name columns shorter for `shard stats`
3
+
1
4
  ## 0.3.3 (2015-10-27)
2
5
  - Moved `shard_stats` to subcommand `shard stats`
3
6
 
@@ -9,7 +9,7 @@ module Elastomer
9
9
  no_commands do
10
10
  def stats_table
11
11
  Terminal::Table.new do |table|
12
- table << node_names.dup.unshift(nil)
12
+ table << [nil] + normalized_node_names
13
13
  table << generate_row("total", node_data)
14
14
  table << :separator
15
15
 
@@ -160,6 +160,34 @@ module Elastomer
160
160
  @node_names ||= node_data.keys.sort
161
161
  end
162
162
 
163
+ # Given the list of node names, extract the first unique name segment
164
+ # and use that as the normalized node name. The node name is divided
165
+ # into segments by splitting on the dash "-" character.
166
+ #
167
+ # Given the followin node names:
168
+ #
169
+ # ["githubsearch3-storage1-cp1-prd", "githubsearch3-storage2-cp1-prd"]
170
+ #
171
+ # the resulting normalized names would be:
172
+ #
173
+ # ["storage1", "storage2"]
174
+ #
175
+ def normalized_node_names
176
+ ary = node_names.map {|name| name.split("-")}
177
+
178
+ names = []
179
+
180
+ ary.first.length.times do |col|
181
+ name_part = ary.map {|row| row[col]}
182
+ if name_part.uniq.length != 1
183
+ names = name_part
184
+ break
185
+ end
186
+ end
187
+
188
+ names
189
+ end
190
+
163
191
  end
164
192
  end
165
193
  end
@@ -1,5 +1,5 @@
1
1
  module Elastomer
2
2
  module CLI
3
- VERSION = "0.3.3"
3
+ VERSION = "0.3.4"
4
4
  end
5
5
  end
data/test/shard_test.rb CHANGED
@@ -9,5 +9,13 @@ describe Elastomer::CLI::Shard do
9
9
  @out.must_match /audit_log/m
10
10
  end
11
11
  end
12
+
13
+ it 'should normalize node names' do
14
+ names = (1..4).map {|n| "githubsearch4-storage%d-cp1-prd" % n}
15
+ @shard_stats = Elastomer::CLI::Shard.new
16
+ @shard_stats.instance_variable_set(:@node_names, names)
17
+
18
+ @shard_stats.normalized_node_names.must_equal %w[storage1 storage2 storage3 storage4]
19
+ end
12
20
  end
13
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elastomer-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grant Rodgers