Class: Ufo::TaskDefinition::Erb::Json

Inherits:
Base show all
Defined in:
lib/ufo/task_definition/erb/json.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
# File 'lib/ufo/task_definition/erb/json.rb', line 3

def data
  text = IO.read(@path)
  JSON.load(text)
rescue JSON::ParserError => e
  # NOTE: JSON::ParserError e.message is not very useful
  logger.error "ERROR: #{e.class}".color(:red)
  logger.error "    Rendered file contains invalid JSON. For debugging, files available at:\n\n    source:   \#{@task_definition.path}\n    rendered: \#{@path}\n\n  EOL\n  logger.error \"Contents of the rendered file:\\n\\n\"\n  print_code(text)\n  if jq_available?\n    system \"cat \#{@path} | jq\"\n  end\n  exit 1\nend\n"

#jq_available?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/ufo/task_definition/erb/json.rb', line 24

def jq_available?
  system("type jq > /dev/null 2>&1")
end