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

#window_size

Methods included from StackMaster::Command

included, #success?

Constructor Details

#initialize(config, 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, show_progress = true)
  @config = config
  @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
# 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)
    progress.increment if @show_progress
    {
      region: stack_definition.region,
      stack_name: stack_definition.stack_name,
      stack_status: stack_status.status,
      different: stack_status.changed_message,
    }
  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