class AwsCftTools::Runbooks::Init

Deploy - manage CloudFormation stack deployment

@example

% aws-cli init # create skeleton project in the current directory

Constants

DEFAULT_CONFIG

The default project configuration file.

FILE_TYPES

The different types of files used when managing templates and stacks.

TEMPLATE_ROLES

The template role directories to build out when creating a project.

Public Instance Methods

run() click to toggle source
# File lib/aws_cft_tools/runbooks/init.rb, line 52
def run
  ensure_project_directory
  ensure_cloudformation_directories
  ensure_config_file
end

Private Instance Methods

ensure_cloudformation_directories() click to toggle source
# File lib/aws_cft_tools/runbooks/init.rb, line 75
def ensure_cloudformation_directories
  FILE_TYPES.product(TEMPLATE_ROLES).map { |list| list.join('/') }.each do |dir|
    ensure_directory(options[:root] + 'cloudformation/' + dir)
  end
end
ensure_config_file() click to toggle source
# File lib/aws_cft_tools/runbooks/init.rb, line 60
def ensure_config_file
  operation('Creating configuration file') do
    file = options[:root] + options[:config_file]
    if file.exist?
      narrative 'Configuration file already exists. Not overwriting.'
    else
      doing { file.write(DEFAULT_CONFIG) }
    end
  end
end
ensure_directory(dir) click to toggle source
# File lib/aws_cft_tools/runbooks/init.rb, line 81
def ensure_directory(dir)
  operation("Ensure #{dir} exists") { dir.mkpath }
end
ensure_project_directory() click to toggle source
# File lib/aws_cft_tools/runbooks/init.rb, line 71
def ensure_project_directory
  ensure_directory(options[:root])
end