Method: Command::ApplyTemplate#call

Defined in:
lib/command/apply_template.rb

#callObject

rubocop:disable Metrics/MethodLength



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/command/apply_template.rb', line 45

def call # rubocop:disable Metrics/MethodLength
  @template_parser = TemplateParser.new(self)
  @names_to_filenames = config.args.to_h do |name|
    [name, @template_parser.template_filename(name)]
  end

  ensure_templates!

  @created_items = []
  @failed_templates = []
  @skipped_templates = []

  templates = @template_parser.parse(@names_to_filenames.values)
  pending_templates = confirm_templates(templates)
  add_app_identity_template(pending_templates) if config.options[:add_app_identity]
  pending_templates.each do |template|
    apply_template(template)
  end

  print_created_items
  print_failed_templates
  print_skipped_templates

  exit(ExitCode::ERROR_DEFAULT) if @failed_templates.any?
end