Class: StackMaster::Commands::Status

Inherits:
Object
  • Object
show all
Includes:
StackMaster::Command, TerminalHelper
Defined in:
lib/stack_master/commands/status.rb

Instance Method Summary collapse

Methods included from TerminalHelper

#unix_window_size, #window_size, #windows_window_size

Methods included from StackMaster::Command

included, #success?

Constructor Details

#initialize(config, options, show_progress = true) ⇒ Status

Returns a new instance of Status.



10
11
12
13
# File 'lib/stack_master/commands/status.rb', line 10

def initialize(config, options, show_progress = true)
  super(config, nil, options)
  @show_progress = show_progress
end

Instance Method Details

#performObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/stack_master/commands/status.rb', line 15

def perform
  progress if @show_progress
  status = @config.stacks.map do |stack_definition|
    stack_status = StackStatus.new(@config, stack_definition)
    allowed_accounts = stack_definition.allowed_accounts
    progress.increment if @show_progress
    {
      region: stack_definition.region,
      stack_name: stack_definition.stack_name,
      stack_status: running_in_allowed_account?(allowed_accounts) ? stack_status.status : "Disallowed account",
      different: running_in_allowed_account?(allowed_accounts) ? stack_status.changed_message : "N/A",
    }
  end
  tp.set :max_width, self.window_size
  tp.set :io, StackMaster.stdout
  tp status
  StackMaster.stdout.puts " * No echo parameters can't be diffed"
end