smartos-manager 1.1.0 → 1.1.1

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: 29841f2633b48a0b3157ce61b2e192a14c48475e
4
- data.tar.gz: 2854a9fa98812383556aa13ac5a9495d68416346
3
+ metadata.gz: b04069d628efefa65d69c71179bf5637d3de581f
4
+ data.tar.gz: 60457d3566a9a510afd5fbe107def4dbbaea4baf
5
5
  SHA512:
6
- metadata.gz: 5faba60549136b532abd89709807a3dd4f2961ad601f7789f9c72e2f8339858b609819aec004174b427f457d97e569de04f51ab03a2d69760612a58113c8145b
7
- data.tar.gz: 6ca13ee99a7bd442d4d5e62a143ea4cad53e06e78002914d3b629bd5fe40e13653117f47f0dcc4e95bf1ffa34345c8e8a423f14dc8d49cdd502f905eed3c99d5
6
+ metadata.gz: b4ce603d565b809a4386e542a355437780e2ed1afd1ecaf0be5e14b4ca1fca165aa7f0028953bd5a3508b86586696060c3560a6a93d2e8d5ee6b306ea284b4c1
7
+ data.tar.gz: 903447464addafc64449bbc87148e773095bf9620fdb408f852db5e15337905bcd0950ce23c8b567d3f96a79099ea8f0f9fd22046df58b9e777dc50d011a1916
@@ -3,12 +3,28 @@ require File.expand_path('../core', __FILE__)
3
3
  require 'thor'
4
4
  require 'colored'
5
5
 
6
+
7
+ class ColorPicker
8
+
9
+ def initialize
10
+ @colors = {}
11
+ @available_colors = %w(green yellow red cyan magenta blue)
12
+ end
13
+
14
+ def get(str)
15
+ @colors[str] ||= @available_colors.shift()
16
+ end
17
+
18
+ end
19
+
6
20
  class AppCLI < Thor
7
21
  desc "list", "List all vms"
8
22
  def list
9
23
  registry = HostRegistry.new('smartos_hosts.toml')
10
24
  ret = registry.list_vms()
11
25
 
26
+ rev_colors = ColorPicker.new
27
+
12
28
  sysinfos = registry.sysinfo()
13
29
 
14
30
  user_columns = registry.user_columns.keys.map{|s| humanize(s) }
@@ -23,7 +39,7 @@ class AppCLI < Thor
23
39
  avail = (mem - vm_memory) - (20 * mem/100.0)
24
40
 
25
41
  rev = sysinfos[host][:smartos_version]
26
- puts "\n#{host.name} [SmartOS: #{rev.green}] (#{host.address}) (#{vms.size} vms) (Total RAM: #{mem.human_size(1).green}, Avail: #{avail.human_size(1).magenta})"
42
+ puts "\n#{host.name} [SmartOS: #{rev.send(rev_colors.get(rev))}] (#{host.address}) (#{vms.size} vms) (Total RAM: #{mem.human_size(1).green}, Avail: #{avail.human_size(1).magenta})"
27
43
  vms.each do |vm|
28
44
  user_columns = registry.user_columns.values.map{|key| vm[key] }
29
45
  p_vm_list(vm.memory.human_size(1), vm.name, vm.type, vm.uuid, printable_state(vm.state), vm.admin_ip, *user_columns)
@@ -1,3 +1,3 @@
1
1
  module SmartosManager
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smartos-manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julien Ammous