Class: CfDeployer::StatusPresenter
- Inherits:
-
Object
- Object
- CfDeployer::StatusPresenter
- Defined in:
- lib/cf_deployer/status_presenter.rb
Constant Summary collapse
- VERBOSITY_3_SKIP =
['AWS::AutoScaling::AutoScalingGroup','AWS::EC2::Instance',:asg_instances, :instances]
- PAD =
" "- UNPADDED_TABLE_CELL_WIDTH =
85
Instance Method Summary collapse
-
#initialize(status_info, verbosity) ⇒ StatusPresenter
constructor
A new instance of StatusPresenter.
- #output ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(status_info, verbosity) ⇒ StatusPresenter
Returns a new instance of StatusPresenter.
12 13 14 15 16 |
# File 'lib/cf_deployer/status_presenter.rb', line 12 def initialize status_info, verbosity @verbosity = verbosity @info = status_info @output = [] end |
Instance Method Details
#output ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/cf_deployer/status_presenter.rb', line 22 def output @output << table_seperator @info.each do |component_name, stacks_hash| @output << "\n#{centered(component_name.upcase)}\n" @output << table_seperator stack_cells = [] stacks_hash.each do |stack_name, stack_hash| stack_output = [''] stack_output << PAD + [ colorized_stack_name(stack_name, stack_hash), stack_active_str(stack_hash[:active]).ljust(15), stack_hash[:status].capitalize ].join(PAD) if stack_hash[:resources] && @verbosity != 'stacks' instances_status stack_output, component_name, stack_name, stack_hash[:resources][:instances], false asgs_status stack_output, component_name, stack_name, stack_hash[:resources][:asg_instances] resource_status stack_output, stack_hash[:resources] if @verbosity == 'all' end stack_output << '' stack_cells << stack_output end stack_cells[1] ||= [''] @output += tableize( stack_cells ) end @output.join "\n" end |
#to_json ⇒ Object
18 19 20 |
# File 'lib/cf_deployer/status_presenter.rb', line 18 def to_json filter_for_verbosity(@info).to_json end |