Module: CfnDsl

Defined in:
lib/cfndsl.rb,
lib/cfndsl/names.rb,
lib/cfndsl/types.rb,
lib/cfndsl/errors.rb,
lib/cfndsl/globals.rb,
lib/cfndsl/outputs.rb,
lib/cfndsl/patches.rb,
lib/cfndsl/plurals.rb,
lib/cfndsl/version.rb,
lib/cfndsl/jsonable.rb,
lib/cfndsl/mappings.rb,
lib/cfndsl/os/types.rb,
lib/cfndsl/aws/types.rb,
lib/cfndsl/rake_task.rb,
lib/cfndsl/resources.rb,
lib/cfndsl/conditions.rb,
lib/cfndsl/parameters.rb,
lib/cfndsl/properties.rb,
lib/cfndsl/specification.rb,
lib/cfndsl/update_policy.rb,
lib/cfndsl/creation_policy.rb,
lib/cfndsl/os/heat_template.rb,
lib/cfndsl/external_parameters.rb,
lib/cfndsl/orchestration_template.rb,
lib/cfndsl/json_serialisable_object.rb,
lib/cfndsl/aws/cloud_formation_template.rb

Overview

Global variables to adjust CfnDsl behavior

Defined Under Namespace

Modules: AWS, Errors, Functions, JSONSerialisableObject, OS, Patches, Plurals, Specification, Types Classes: CloudFormationTemplate, ConditionDefinition, CreationPolicyDefinition, ExternalParameters, Fn, HeatTemplate, JSONable, MappingDefinition, OrchestrationTemplate, OutputDefinition, ParameterDefinition, PropertyDefinition, RakeTask, RefDefinition, ResourceDefinition, UpdatePolicyDefinition

Constant Summary

VERSION =
'0.16.6'.freeze

Class Method Summary collapse

Class Method Details

.disable_bindingObject



5
6
7
# File 'lib/cfndsl/globals.rb', line 5

def disable_binding
  @disable_binding = true
end

.disable_binding?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/cfndsl/globals.rb', line 9

def disable_binding?
  @disable_binding
end

.disable_deep_mergeObject



13
14
15
# File 'lib/cfndsl/globals.rb', line 13

def disable_deep_merge
  @disable_deep_merge = true
end

.disable_deep_merge?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/cfndsl/globals.rb', line 17

def disable_deep_merge?
  @disable_deep_merge
end

.eval_file_with_extras(filename, extras = [], logstream = nil) ⇒ Object

rubocop:disable all



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/cfndsl.rb', line 59

def self.eval_file_with_extras(filename, extras = [], logstream = nil)
  b = binding
  params = CfnDsl::ExternalParameters.refresh!
  extras.each do |type, file|
    case type
    when :yaml, :json
      klass_name = type.to_s.upcase
      logstream.puts("Loading #{klass_name} file #{file}") if logstream
      params.load_file file
      params.add_to_binding(b, logstream) unless disable_binding?
    when :ruby
      if disable_binding?
        logstream.puts("Interpreting Ruby files was disabled. #{file} will not be read") if logstream
      else
        logstream.puts("Running ruby file #{file}") if logstream
        b.eval(File.read(file), file)
      end
    when :raw
      file_parts = file.split("=")
      params.set_param(file_parts[0],file_parts[1..-1].join("="))
      unless disable_binding?
        logstream.puts("Running raw ruby code #{file}") if logstream
        b.eval(file, 'raw code')
      end
    end
  end

  logstream.puts("Loading template file #{filename}") if logstream
  b.eval(File.read(filename), filename)
end

.method_names(name) ⇒ Object

iterates through the the valid case-insensitive names for “name”



7
8
9
10
11
# File 'lib/cfndsl/names.rb', line 7

def method_names(name)
  name_str = name.to_s.dup
  names = [name_str, name_str.gsub(/^\w/, &:swapcase)]
  block_given? ? names.each { |n| yield n.to_sym } : names
end

.reserved_itemsObject



27
28
29
# File 'lib/cfndsl/globals.rb', line 27

def reserved_items
  %w[Resource Parameter Output].freeze
end

.specification_file(file = nil) ⇒ Object



21
22
23
24
25
# File 'lib/cfndsl/globals.rb', line 21

def specification_file(file = nil)
  @specification_file = file if file
  @specification_file ||= File.join(ENV['HOME'], '.cfndsl/resource_specification.json')
  @specification_file
end