lib/sfn/command/describe.rb in sfn-3.0.28 vs lib/sfn/command/describe.rb in sfn-3.0.30

- old
+ new

@@ -2,31 +2,30 @@ module Sfn class Command # Cloudformation describe command class Describe < Command - include Sfn::CommandModule::Base # information available - unless(defined?(AVAILABLE_DISPLAYS)) + unless defined?(AVAILABLE_DISPLAYS) AVAILABLE_DISPLAYS = [:resources, :outputs, :tags] end # Run the stack describe action def execute! name_required! stack_name = name_args.last root_stack = api_action! do provider.stack(stack_name) end - if(root_stack) + if root_stack ([root_stack] + root_stack.nested_stacks).compact.each do |stack| ui.info "Stack description of #{ui.color(stack.name, :bold)}:" display = [].tap do |to_display| AVAILABLE_DISPLAYS.each do |display_option| - if(config[display_option]) + if config[display_option] to_display << display_option end end end display = AVAILABLE_DISPLAYS.dup if display.empty? @@ -52,11 +51,11 @@ end ui.table(self) do table(:border => false) do row(:header => true) do allowed_attributes.each do |attr| - column as_title(attr), :width => stack_resources.map{|r| r[attr].to_s.length}.push(as_title(attr).length).max + 2 + column as_title(attr), :width => stack_resources.map { |r| r[attr].to_s.length }.push(as_title(attr).length).max + 2 end end stack_resources.each do |resource| row do allowed_attributes.each do |attr| @@ -71,11 +70,11 @@ # Display outputs # # @param stack [Miasma::Models::Orchestration::Stack] def outputs(stack) ui.info "Outputs for stack: #{ui.color(stack.name, :bold)}" - unless(stack.outputs.nil? || stack.outputs.empty?) + unless stack.outputs.nil? || stack.outputs.empty? stack.outputs.each do |output| key, value = output.key, output.value key = snake(key).to_s.split('_').map(&:capitalize).join(' ') ui.info [' ', ui.color("#{key}:", :bold), value].join(' ') end @@ -87,11 +86,11 @@ # Display tags # # @param stack [Miasma::Models::Orchestration::Stack] def tags(stack) ui.info "Tags for stack: #{ui.color(stack.name, :bold)}" - if(stack.tags && !stack.tags.empty?) + if stack.tags && !stack.tags.empty? stack.tags.each do |key, value| ui.info [' ', ui.color("#{key}:", :bold), value].join(' ') end else ui.info " #{ui.color('No tags found')}" @@ -100,9 +99,8 @@ # @return [Array<String>] default attributes def default_attributes %w(updated logical_id type status status_reason) end - end end end