Class: Ufo::TaskDefinition::Erb::Yaml

Inherits:
Base show all
Defined in:
lib/ufo/task_definition/erb/yaml.rb

Instance Attribute Summary

Attributes inherited from CLI::Base

#task_definition

Instance Method Summary collapse

Methods inherited from Base

#initialize, #print_code

Methods inherited from CLI::Base

#initialize

Methods included from Utils::Sure

#sure?

Methods included from Utils::Pretty

#pretty_home, #pretty_path, #pretty_time

Methods included from Utils::Logging

#logger

Methods included from Concerns

#build, #deploy, #info, #ps

Methods included from Concerns::Names

#names

Methods included from AwsServices

#acm, #applicationautoscaling, #aws_options, #cfn, #cloudwatchlogs, #ec2, #ecr, #ecs, #elb, #s3, #ssm_client, #waf_client

Methods included from AwsServices::Concerns

#find_stack, #find_stack_resources, #stack_resources, #status, #task_definition_arns

Constructor Details

This class inherits a constructor from Ufo::TaskDefinition::Erb::Base

Instance Method Details

#dataObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/ufo/task_definition/erb/yaml.rb', line 3

def data
  text = IO.read(@path)
  YAML.load(text)
rescue Psych::SyntaxError => e
  logger.error "ERROR: #{e.class}: #{e.message}".color(:red)
  logger.error <<~EOL
    Rendered file contains invalid YAML. For debugging, files available at:

    source:   #{@task_definition.path}
    compiled: #{@path}

  EOL

  md = e.message.match(/at line (\d+) column (\d+)/)
  if md
    line_number = md[1]
    DslEvaluator.print_code(@path, line_number)
  else
    print_code(text) # fallback to simpler print code if cannot find line numbers
  end
end