Module: Vagabond::Actions::Status

Included in:
Kitchen, Spec
Defined in:
lib/vagabond/actions/status.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/vagabond/actions/status.rb', line 6

def included(klass)
  klass.class_eval do
    class << self
      def _status_desc
        if(defined?(Server) && self == Server)
          ['status', 'Status of server']
        else
          ['status [NODE]', 'Status of NODE or all nodes']
        end
      end
    end
  end
end

Instance Method Details

#_statusObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/vagabond/actions/status.rb', line 21

def _status
  status = [
    ui.color('Name', :bold),
    ui.color('State', :bold),
    ui.color('PID', :bold),
    ui.color('IP', :bold)
  ]
  if(name)
    status += status_for(name)
  else
    if(self.is_a?(Vagabond))
      names = (Array(vagabondfile[:boxes].keys) | Array(internal_config[mappings_key].keys))
    else
      names = Array(internal_config[mappings_key].keys)
    end
    names.sort.each do |n|
      status += status_for(n)
    end
  end
  puts ui.list(status, :uneven_columns_across, 4)
end