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

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
      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

  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