Class: AwsCftTools::Client::Templates

Inherits:
Base
  • Object
show all
Defined in:
lib/aws_cft_tools/client/templates.rb

Overview

All of the business logic behind direct interaction with the AWS Template sources.

Constant Summary collapse

DEFAULT_TEMPLATE_DIR =

Default template directory in the project.

'cloudformation/templates/'
DEFAULT_PARAMETER_DIR =

Default parameters directory in the project.

'cloudformation/parameters/'
TEMPLATE_FILE_EXTENSIONS =

Default set of file extensions that might contain templates.

%w[.yaml .yml .json .rb].freeze

Instance Attribute Summary

Attributes inherited from Base

#options

Instance Method Summary collapse

Methods inherited from Base

#aws_client, aws_client_class

Constructor Details

#initialize(options) ⇒ Templates

Returns a new instance of Templates.

Parameters:

  • options (Hash)

    client configuration

Options Hash (options):

  • :environment (String)

    the operational environment in which to act

  • :parameter_dir (String)
  • :region (String)

    the AWS region in which to act

  • :root (Pathname)
  • :template_dir (String)


33
34
35
36
37
38
# File 'lib/aws_cft_tools/client/templates.rb', line 33

def initialize(options)
  super({
    template_dir: DEFAULT_TEMPLATE_DIR,
    parameter_dir: DEFAULT_PARAMETER_DIR
  }.merge(options))
end

Instance Method Details

#templatesObject

Lists all templates.

Returns:

  • AwsCftTools::TemplateSet



45
46
47
48
49
50
51
52
53
54
# File 'lib/aws_cft_tools/client/templates.rb', line 45

def templates
  template_file_root = (options[:root] + options[:template_dir]).cleanpath
  filtered_by_region(
    filtered_by_environment(
      all_templates(
        template_file_root
      )
    )
  )
end