Module: CfnDsl

Defined in:
lib/cfndsl.rb,
lib/cfndsl/names.rb,
lib/cfndsl/types.rb,
lib/cfndsl/errors.rb,
lib/cfndsl/outputs.rb,
lib/cfndsl/plurals.rb,
lib/cfndsl/version.rb,
lib/cfndsl/jsonable.rb,
lib/cfndsl/mappings.rb,
lib/cfndsl/metadata.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/update_policy.rb,
lib/cfndsl/generate_types.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

Method name helper

Defined Under Namespace

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

Constant Summary collapse

VERSION =
'0.8.2'.freeze

Class Method Summary collapse

Class Method Details

.disable_bindingObject



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

def self.disable_binding
  @disable_binding = true
end

.disable_binding?Boolean

Returns:

  • (Boolean)


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

def self.disable_binding?
  @disable_binding
end

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

rubocop:disable all



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
89
90
91
# File 'lib/cfndsl.rb', line 62

def self.eval_file_with_extras(filename, extras = [], logstream = nil)
  b = binding
  params = CfnDsl::ExternalParameters.new
  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
      params.set_param(*file.split('='))
      unless disable_binding?
        logstream.puts("Running raw ruby code #{file}") if logstream
        b.eval(file, 'raw code')
      end
    end
  end

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

.method_names(name, &block) ⇒ Object

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



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/cfndsl/names.rb', line 5

def self.method_names(name, &block)
  if block
    name_str = name.to_s
    yield name_str.to_sym
    n = name_str.dup
    n[0] = n[0].swapcase
    yield n.to_sym
  else
    result = [name.dup, name.dup]
    result[1][0] = result[1][0].swapcase
    return result
  end
end