Class: EcsDeployCli::Runners::Diff

Inherits:
Base
  • Object
show all
Defined in:
lib/ecs_deploy_cli/runners/diff.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize, #update_task

Constructor Details

This class inherits a constructor from EcsDeployCli::Runners::Base

Instance Method Details

#run!Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/ecs_deploy_cli/runners/diff.rb', line 6

def run!
  require 'hashdiff'
  require 'colorize'

  _, tasks, = @parser.resolve

  tasks.each do |task_name, definition|
    EcsDeployCli.logger.info '---'
    EcsDeployCli.logger.info "Task: #{task_name}"

    result = ecs_client.describe_task_definition(task_definition: task_name).to_h

    current = cleanup_source_task(result[:task_definition])
    definition = cleanup_source_task(definition)

    print_diff Hashdiff.diff(current.except(:container_definitions), definition.except(:container_definitions))

    diff_container_definitions(
      current[:container_definitions],
      definition[:container_definitions]
    )

    EcsDeployCli.logger.info '---'
  end
end