Class: TemplateDiscovery

Inherits:
Object show all
Defined in:
lib/cfn-nag/template_discovery.rb

Overview

Container for discovering templates

Instance Method Summary collapse

Instance Method Details

#discover_templates(input_json_path:, template_pattern: '..*\.json|..*\.yaml|..*\.yml|..*\.template') ⇒ Object

input_json_path can be a directory, filename, or File



6
7
8
9
10
11
12
13
14
15
# File 'lib/cfn-nag/template_discovery.rb', line 6

def discover_templates(input_json_path:,
                       template_pattern: '..*\.json|..*\.yaml|..*\.yml|..*\.template')
  if ::File.directory? input_json_path
    return find_templates_in_directory(directory: input_json_path,
                                       template_pattern: template_pattern)
  end
  return [render_path(input_json_path)] if ::File.file? input_json_path

  raise "#{input_json_path} is not a proper path"
end