cfhighlander 0.11.2 → 0.12.0.alpha.1586682642
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/README.md +10 -0
 - data/lib/cfhighlander.dsl.subcomponent.rb +1 -1
 - data/lib/cfhighlander.dsl.template.rb +26 -18
 - data/lib/cfhighlander.factory.rb +2 -2
 - data/lib/cfhighlander.factory.templatefinder.rb +8 -3
 - data/lib/cfhighlander.model.component.rb +10 -2
 - data/lib/cfhighlander.version.rb +1 -1
 - metadata +4 -4
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 02bbde329ed3125c83f384cca69be0862a1230a790a37f4c76f12701d5cd2fc1
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 9ac2c3a65c60e09326d55c8232933bf2478bb5d55fbff40d4a9059e602443049
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 8dfe1520ed5ccf4962db0aa59353e027b4e7f50b23f36f0b73e1d4298a73cab78a35ee7fb8677f73fc0b647371d964c665fcbdac1b21218602f1f638af1b7414
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: eba6515819000dc62cd07e5d53bdbe1438e94f36b867abd1fefe4d8fb076b4ec70e0e8c94e0875175e1f9eea4c2c31bbb60b1127dc56230e62d5253345021880
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -301,6 +301,16 @@ compiled cloudformation templates). Same CLI / DSL options apply as for *cfpubli 
     | 
|
| 
       301 
301 
     | 
    
         | 
| 
       302 
302 
     | 
    
         
             
            ## Component configuration
         
     | 
| 
       303 
303 
     | 
    
         | 
| 
      
 304 
     | 
    
         
            +
            ### Default configuration values
         
     | 
| 
      
 305 
     | 
    
         
            +
             
     | 
| 
      
 306 
     | 
    
         
            +
            Within each template, following configuration values are available by default in both cfhl and cfndsl templates
         
     | 
| 
      
 307 
     | 
    
         
            +
             
     | 
| 
      
 308 
     | 
    
         
            +
            - `template_name` - Name of the cfhighlander template
         
     | 
| 
      
 309 
     | 
    
         
            +
            - `template_verison` - Version of the cfhighlander component template used
         
     | 
| 
      
 310 
     | 
    
         
            +
            - `template_dir` - Disk location of the cfhighlander template. Can be used to reference local files within component, and does work with component inheritance
         
     | 
| 
      
 311 
     | 
    
         
            +
             
     | 
| 
      
 312 
     | 
    
         
            +
            ### Defining and overriding configuration
         
     | 
| 
      
 313 
     | 
    
         
            +
             
     | 
| 
       304 
314 
     | 
    
         
             
            There are 4 levels of component configuration
         
     | 
| 
       305 
315 
     | 
    
         | 
| 
       306 
316 
     | 
    
         
             
            - Component local config file `component.config.yaml` (lowest priority)
         
     | 
| 
         @@ -81,7 +81,7 @@ module Cfhighlander 
     | 
|
| 
       81 
81 
     | 
    
         
             
                    build_distribution_url
         
     | 
| 
       82 
82 
     | 
    
         | 
| 
       83 
83 
     | 
    
         
             
                    # load component
         
     | 
| 
       84 
     | 
    
         
            -
                    factory = Cfhighlander::Factory::ComponentFactory.new(@component_sources)
         
     | 
| 
      
 84 
     | 
    
         
            +
                    factory = Cfhighlander::Factory::ComponentFactory.new(@component_sources, parent.template_dir)
         
     | 
| 
       85 
85 
     | 
    
         
             
                    @component_loaded = factory.loadComponentFromTemplate(
         
     | 
| 
       86 
86 
     | 
    
         
             
                        @template,
         
     | 
| 
       87 
87 
     | 
    
         
             
                        @template_version,
         
     | 
| 
         @@ -2,7 +2,7 @@ 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            extensions_folder = "#{File.dirname(__FILE__)}/../hl_ext"
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
     | 
    
         
            -
            Dir["#{extensions_folder}/*.rb"].each {|f|
         
     | 
| 
      
 5 
     | 
    
         
            +
            Dir["#{extensions_folder}/*.rb"].each { |f|
         
     | 
| 
       6 
6 
     | 
    
         
             
              require f
         
     | 
| 
       7 
7 
     | 
    
         
             
            }
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
         @@ -36,7 +36,8 @@ module Cfhighlander 
     | 
|
| 
       36 
36 
     | 
    
         
             
                      :distribution_prefix,
         
     | 
| 
       37 
37 
     | 
    
         
             
                      :lambda_functions_keys,
         
     | 
| 
       38 
38 
     | 
    
         
             
                      :description,
         
     | 
| 
       39 
     | 
    
         
            -
                      :dependson_components
         
     | 
| 
      
 39 
     | 
    
         
            +
                      :dependson_components,
         
     | 
| 
      
 40 
     | 
    
         
            +
                      :template_dir
         
     | 
| 
       40 
41 
     | 
    
         | 
| 
       41 
42 
     | 
    
         
             
                  attr_reader :conditions,
         
     | 
| 
       42 
43 
     | 
    
         
             
                      :subcomponents,
         
     | 
| 
         @@ -61,6 +62,7 @@ module Cfhighlander 
     | 
|
| 
       61 
62 
     | 
    
         
             
                    @extended_template = nil
         
     | 
| 
       62 
63 
     | 
    
         
             
                    # execution blocks for subcomponents
         
     | 
| 
       63 
64 
     | 
    
         
             
                    @subcomponents_exec = {}
         
     | 
| 
      
 65 
     | 
    
         
            +
                    @template_dir = nil
         
     | 
| 
       64 
66 
     | 
    
         
             
                  end
         
     | 
| 
       65 
67 
     | 
    
         | 
| 
       66 
68 
     | 
    
         
             
                  # DSL statements
         
     | 
| 
         @@ -85,6 +87,11 @@ module Cfhighlander 
     | 
|
| 
       85 
87 
     | 
    
         
             
                    @config['description'] = description
         
     | 
| 
       86 
88 
     | 
    
         
             
                  end
         
     | 
| 
       87 
89 
     | 
    
         | 
| 
      
 90 
     | 
    
         
            +
                  def template_dir=(value)
         
     | 
| 
      
 91 
     | 
    
         
            +
                    @template_dir = value
         
     | 
| 
      
 92 
     | 
    
         
            +
                    @config['template_dir'] = value
         
     | 
| 
      
 93 
     | 
    
         
            +
                  end
         
     | 
| 
      
 94 
     | 
    
         
            +
             
     | 
| 
       88 
95 
     | 
    
         
             
                  def Parameters(&block)
         
     | 
| 
       89 
96 
     | 
    
         
             
                    @parameters.config = @config
         
     | 
| 
       90 
97 
     | 
    
         
             
                    @parameters.instance_eval(&block) unless block.nil?
         
     | 
| 
         @@ -100,7 +107,7 @@ module Cfhighlander 
     | 
|
| 
       100 
107 
     | 
    
         | 
| 
       101 
108 
     | 
    
         
             
                  def DynamicMappings(providerName)
         
     | 
| 
       102 
109 
     | 
    
         
             
                    maps = mappings_provider_maps(providerName, self.config)
         
     | 
| 
       103 
     | 
    
         
            -
                    maps.each {|name, map| addMapping(name, map)} unless maps.nil?
         
     | 
| 
      
 110 
     | 
    
         
            +
                    maps.each { |name, map| addMapping(name, map) } unless maps.nil?
         
     | 
| 
       104 
111 
     | 
    
         
             
                  end
         
     | 
| 
       105 
112 
     | 
    
         | 
| 
       106 
113 
     | 
    
         
             
                  def DependsOn(template)
         
     | 
| 
         @@ -131,7 +138,7 @@ module Cfhighlander 
     | 
|
| 
       131 
138 
     | 
    
         
             
                    end
         
     | 
| 
       132 
139 
     | 
    
         | 
| 
       133 
140 
     | 
    
         
             
                    name = template if name.nil?
         
     | 
| 
       134 
     | 
    
         
            -
             
     | 
| 
      
 141 
     | 
    
         
            +
             
     | 
| 
       135 
142 
     | 
    
         
             
                    # load component
         
     | 
| 
       136 
143 
     | 
    
         
             
                    component = Cfhighlander::Dsl::Subcomponent.new(self,
         
     | 
| 
       137 
144 
     | 
    
         
             
                        name,
         
     | 
| 
         @@ -205,8 +212,8 @@ module Cfhighlander 
     | 
|
| 
       205 
212 
     | 
    
         
             
                  def loadComponents
         
     | 
| 
       206 
213 
     | 
    
         | 
| 
       207 
214 
     | 
    
         
             
                    # empty config overrides to start with
         
     | 
| 
       208 
     | 
    
         
            -
                    @config_overrides = Hash[@subcomponents.collect {|c| [c.name, { 'nested_component' => true }]}]
         
     | 
| 
       209 
     | 
    
         
            -
                    @named_components = Hash[@subcomponents.collect {|c| [c.name, c]}]
         
     | 
| 
      
 215 
     | 
    
         
            +
                    @config_overrides = Hash[@subcomponents.collect { |c| [c.name, { 'nested_component' => true }] }]
         
     | 
| 
      
 216 
     | 
    
         
            +
                    @named_components = Hash[@subcomponents.collect { |c| [c.name, c] }]
         
     | 
| 
       210 
217 
     | 
    
         | 
| 
       211 
218 
     | 
    
         
             
                    # populate overrides with master config defined overrides
         
     | 
| 
       212 
219 
     | 
    
         
             
                    load_configfile_component_config
         
     | 
| 
         @@ -308,14 +315,14 @@ module Cfhighlander 
     | 
|
| 
       308 
315 
     | 
    
         
             
                  end
         
     | 
| 
       309 
316 
     | 
    
         | 
| 
       310 
317 
     | 
    
         
             
                  def apply_config_overrides
         
     | 
| 
       311 
     | 
    
         
            -
                    @config_overrides.each {|component_name, component_override|
         
     | 
| 
      
 318 
     | 
    
         
            +
                    @config_overrides.each { |component_name, component_override|
         
     | 
| 
       312 
319 
     | 
    
         
             
                      @named_components[component_name].component_loaded.config.extend(component_override)
         
     | 
| 
       313 
320 
     | 
    
         
             
                    }
         
     | 
| 
       314 
321 
     | 
    
         
             
                  end
         
     | 
| 
       315 
322 
     | 
    
         | 
| 
       316 
323 
     | 
    
         
             
                  def load_configfile_component_config
         
     | 
| 
       317 
324 
     | 
    
         
             
                    if (@config.key? 'components')
         
     | 
| 
       318 
     | 
    
         
            -
                      @config['components'].each {|component_name, component_config|
         
     | 
| 
      
 325 
     | 
    
         
            +
                      @config['components'].each { |component_name, component_config|
         
     | 
| 
       319 
326 
     | 
    
         
             
                        if component_config.key?('config')
         
     | 
| 
       320 
327 
     | 
    
         
             
                          if @config_overrides.key? component_name
         
     | 
| 
       321 
328 
     | 
    
         
             
                            @config_overrides[component_name].extend(component_config['config'])
         
     | 
| 
         @@ -330,28 +337,28 @@ module Cfhighlander 
     | 
|
| 
       330 
337 
     | 
    
         
             
                  def apply_config_exports
         
     | 
| 
       331 
338 
     | 
    
         
             
                    # first export from master to all children
         
     | 
| 
       332 
339 
     | 
    
         
             
                    if ((@config.key? 'config_export') and (@config['config_export']['global']))
         
     | 
| 
       333 
     | 
    
         
            -
                      @config['config_export']['global'].each {|global_export_key|
         
     | 
| 
      
 340 
     | 
    
         
            +
                      @config['config_export']['global'].each { |global_export_key|
         
     | 
| 
       334 
341 
     | 
    
         
             
                        if @config.key? global_export_key
         
     | 
| 
       335 
     | 
    
         
            -
                          @config_overrides.each {|cname, co|
         
     | 
| 
      
 342 
     | 
    
         
            +
                          @config_overrides.each { |cname, co|
         
     | 
| 
       336 
343 
     | 
    
         
             
                            co[global_export_key] = @config[global_export_key]
         
     | 
| 
       337 
344 
     | 
    
         
             
                          }
         
     | 
| 
       338 
345 
     | 
    
         
             
                        end
         
     | 
| 
       339 
346 
     | 
    
         
             
                      }
         
     | 
| 
       340 
347 
     | 
    
         
             
                    end
         
     | 
| 
       341 
348 
     | 
    
         | 
| 
       342 
     | 
    
         
            -
                    @subcomponents.each {|component|
         
     | 
| 
      
 349 
     | 
    
         
            +
                    @subcomponents.each { |component|
         
     | 
| 
       343 
350 
     | 
    
         
             
                      cl = component.component_loaded
         
     | 
| 
       344 
351 
     | 
    
         
             
                      if ((not cl.config.nil?) and (cl.config.key? 'config_export'))
         
     | 
| 
       345 
352 
     | 
    
         | 
| 
       346 
353 
     | 
    
         
             
                        # global config
         
     | 
| 
       347 
354 
     | 
    
         
             
                        if cl.config['config_export'].key? 'global'
         
     | 
| 
       348 
     | 
    
         
            -
                          cl.config['config_export']['global'].each {|global_export_key|
         
     | 
| 
      
 355 
     | 
    
         
            +
                          cl.config['config_export']['global'].each { |global_export_key|
         
     | 
| 
       349 
356 
     | 
    
         | 
| 
       350 
357 
     | 
    
         
             
                            # global config is exported to parent and every component
         
     | 
| 
       351 
358 
     | 
    
         
             
                            if cl.config.key? global_export_key
         
     | 
| 
       352 
359 
     | 
    
         | 
| 
       353 
360 
     | 
    
         
             
                              # cname is for component name, co for component override
         
     | 
| 
       354 
     | 
    
         
            -
                              @config_overrides.each {|cname, co|
         
     | 
| 
      
 361 
     | 
    
         
            +
                              @config_overrides.each { |cname, co|
         
     | 
| 
       355 
362 
     | 
    
         | 
| 
       356 
363 
     | 
    
         
             
                                # if templates are different e.g don't export from vpc to vpc
         
     | 
| 
       357 
364 
     | 
    
         
             
                                config_receiver_component = @named_components[cname]
         
     | 
| 
         @@ -377,7 +384,7 @@ module Cfhighlander 
     | 
|
| 
       377 
384 
     | 
    
         
             
                        end
         
     | 
| 
       378 
385 
     | 
    
         | 
| 
       379 
386 
     | 
    
         
             
                        if cl.config['config_export'].key? 'component'
         
     | 
| 
       380 
     | 
    
         
            -
                          cl.config['config_export']['component'].each {|component_name, export_keys|
         
     | 
| 
      
 387 
     | 
    
         
            +
                          cl.config['config_export']['component'].each { |component_name, export_keys|
         
     | 
| 
       381 
388 
     | 
    
         
             
                            # check if there is configuration of export from this component
         
     | 
| 
       382 
389 
     | 
    
         
             
                            # and if there is export configuration for given component name
         
     | 
| 
       383 
390 
     | 
    
         | 
| 
         @@ -386,7 +393,7 @@ module Cfhighlander 
     | 
|
| 
       386 
393 
     | 
    
         
             
                              if @config_overrides.key? component.export_config[component_name]
         
     | 
| 
       387 
394 
     | 
    
         
             
                                # override the config
         
     | 
| 
       388 
395 
     | 
    
         
             
                                real_component_name = component.export_config[component_name]
         
     | 
| 
       389 
     | 
    
         
            -
                                export_keys.each {|export_component_key|
         
     | 
| 
      
 396 
     | 
    
         
            +
                                export_keys.each { |export_component_key|
         
     | 
| 
       390 
397 
     | 
    
         
             
                                  puts("Exporting config for key=#{export_component_key} from #{component.name} to #{real_component_name}")
         
     | 
| 
       391 
398 
     | 
    
         
             
                                  if not @config_overrides[real_component_name].key? export_component_key
         
     | 
| 
       392 
399 
     | 
    
         
             
                                    @config_overrides[real_component_name][export_component_key] = {}
         
     | 
| 
         @@ -397,7 +404,7 @@ module Cfhighlander 
     | 
|
| 
       397 
404 
     | 
    
         
             
                                STDERR.puts("Trying to export configuration for non-existant component #{component.export_config[component_name]}")
         
     | 
| 
       398 
405 
     | 
    
         
             
                              end
         
     | 
| 
       399 
406 
     | 
    
         
             
                            elsif @config_overrides.key? component_name
         
     | 
| 
       400 
     | 
    
         
            -
                              export_keys.each {|export_component_key|
         
     | 
| 
      
 407 
     | 
    
         
            +
                              export_keys.each { |export_component_key|
         
     | 
| 
       401 
408 
     | 
    
         
             
                                puts("Exporting config for key=#{export_component_key} from #{component.name} to #{component_name}")
         
     | 
| 
       402 
409 
     | 
    
         
             
                                if not @config_overrides[component_name].key? export_component_key
         
     | 
| 
       403 
410 
     | 
    
         
             
                                  @config_overrides[component_name][export_component_key] = {}
         
     | 
| 
         @@ -417,7 +424,7 @@ module Cfhighlander 
     | 
|
| 
       417 
424 
     | 
    
         
             
                  end
         
     | 
| 
       418 
425 
     | 
    
         | 
| 
       419 
426 
     | 
    
         
             
                  def load_explicit_component_config
         
     | 
| 
       420 
     | 
    
         
            -
                    @component_configs.each {|component_name, component_config|
         
     | 
| 
      
 427 
     | 
    
         
            +
                    @component_configs.each { |component_name, component_config|
         
     | 
| 
       421 
428 
     | 
    
         
             
                      @config_overrides[component_name].extend(component_config)
         
     | 
| 
       422 
429 
     | 
    
         
             
                    }
         
     | 
| 
       423 
430 
     | 
    
         | 
| 
         @@ -441,7 +448,7 @@ module Cfhighlander 
     | 
|
| 
       441 
448 
     | 
    
         
             
                    if not (@distribution_bucket.nil? or @distribution_prefix.nil?)
         
     | 
| 
       442 
449 
     | 
    
         
             
                      @distribute_url = "https://#{@distribution_bucket}.s3.amazonaws.com/#{@distribution_prefix}"
         
     | 
| 
       443 
450 
     | 
    
         
             
                      @distribute_url = "#{@distribute_url}/#{@version}" unless @version.nil?
         
     | 
| 
       444 
     | 
    
         
            -
                      @subcomponents.each {|component|
         
     | 
| 
      
 451 
     | 
    
         
            +
                      @subcomponents.each { |component|
         
     | 
| 
       445 
452 
     | 
    
         
             
                        component.distribute_bucket = @distribution_bucket unless @distribution_bucket.nil?
         
     | 
| 
       446 
453 
     | 
    
         
             
                        component.distribute_prefix = @distribution_prefix unless @distribution_prefix.nil?
         
     | 
| 
       447 
454 
     | 
    
         
             
                        component.version = @version unless @version.nil?
         
     | 
| 
         @@ -481,6 +488,7 @@ def CfhighlanderTemplate(&block) 
     | 
|
| 
       481 
488 
     | 
    
         | 
| 
       482 
489 
     | 
    
         | 
| 
       483 
490 
     | 
    
         
             
              instance.name = @template.template_name
         
     | 
| 
      
 491 
     | 
    
         
            +
              instance.template_dir = @template.template_location
         
     | 
| 
       484 
492 
     | 
    
         
             
              instance.instance_eval(&block)
         
     | 
| 
       485 
493 
     | 
    
         | 
| 
       486 
494 
     | 
    
         
             
              unless @distribution_bucket.nil?
         
     | 
    
        data/lib/cfhighlander.factory.rb
    CHANGED
    
    | 
         @@ -13,8 +13,8 @@ module Cfhighlander 
     | 
|
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
                  attr_accessor :component_sources
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
     | 
    
         
            -
                  def initialize(component_sources = [])
         
     | 
| 
       17 
     | 
    
         
            -
                    @template_finder = Cfhighlander::Factory::TemplateFinder.new(component_sources)
         
     | 
| 
      
 16 
     | 
    
         
            +
                  def initialize(component_sources = [], parent_path=nil)
         
     | 
| 
      
 17 
     | 
    
         
            +
                    @template_finder = Cfhighlander::Factory::TemplateFinder.new(component_sources, parent_path)
         
     | 
| 
       18 
18 
     | 
    
         
             
                    @component_sources = component_sources
         
     | 
| 
       19 
19 
     | 
    
         
             
                  end
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
         @@ -8,8 +8,9 @@ module Cfhighlander 
     | 
|
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
                class TemplateFinder
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
                  def initialize(component_sources = [])
         
     | 
| 
       12 
     | 
    
         
            -
                    ## First look in  
     | 
| 
      
 11 
     | 
    
         
            +
                  def initialize(component_sources = [], parent_path = nil)
         
     | 
| 
      
 12 
     | 
    
         
            +
                    ## First look in parent path and it's components folder
         
     | 
| 
      
 13 
     | 
    
         
            +
                    ## Then look in local $PWD/components folder
         
     | 
| 
       13 
14 
     | 
    
         
             
                    ## Then search for cached $HOME/.highlander/components
         
     | 
| 
       14 
15 
     | 
    
         
             
                    ## Then search in sources given by dsl
         
     | 
| 
       15 
16 
     | 
    
         
             
                    default_locations = [
         
     | 
| 
         @@ -17,10 +18,13 @@ module Cfhighlander 
     | 
|
| 
       17 
18 
     | 
    
         
             
                        File.expand_path('components'),
         
     | 
| 
       18 
19 
     | 
    
         
             
                        File.expand_path('.'),
         
     | 
| 
       19 
20 
     | 
    
         
             
                    ]
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
       20 
22 
     | 
    
         
             
                    default_locations << ENV['CFHIGHLANDER_WORKDIR'] if ENV.key? 'CFHIGHLANDER_WORKDIR'
         
     | 
| 
       21 
23 
     | 
    
         
             
                    default_locations.each do |predefined_path|
         
     | 
| 
       22 
24 
     | 
    
         
             
                      component_sources.unshift(predefined_path)
         
     | 
| 
       23 
25 
     | 
    
         
             
                    end
         
     | 
| 
      
 26 
     | 
    
         
            +
                    component_sources.unshift "#{parent_path}/components" if parent_path
         
     | 
| 
      
 27 
     | 
    
         
            +
                    component_sources.unshift parent_path if parent_path
         
     | 
| 
       24 
28 
     | 
    
         | 
| 
       25 
29 
     | 
    
         
             
                    @component_sources = component_sources
         
     | 
| 
       26 
30 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -97,7 +101,7 @@ module Cfhighlander 
     | 
|
| 
       97 
101 
     | 
    
         
             
                      })
         
     | 
| 
       98 
102 
     | 
    
         
             
                      # if code execution got so far we consider file exists and download it locally
         
     | 
| 
       99 
103 
     | 
    
         
             
                      component_files = s3.list_objects_v2({ bucket: bucket, prefix: s3_prefix })
         
     | 
| 
       100 
     | 
    
         
            -
                      component_files.contents.each {|s3_object|
         
     | 
| 
      
 104 
     | 
    
         
            +
                      component_files.contents.each { |s3_object|
         
     | 
| 
       101 
105 
     | 
    
         
             
                        file_name = s3_object.key.gsub(s3_prefix, '')
         
     | 
| 
       102 
106 
     | 
    
         
             
                        destination_file = "#{local_destination}/#{file_name}"
         
     | 
| 
       103 
107 
     | 
    
         
             
                        destination_dir = File.dirname(destination_file)
         
     | 
| 
         @@ -236,6 +240,7 @@ module Cfhighlander 
     | 
|
| 
       236 
240 
     | 
    
         
             
                  end
         
     | 
| 
       237 
241 
     | 
    
         | 
| 
       238 
242 
     | 
    
         
             
                  def build_meta(template_name, template_version, template_location)
         
     | 
| 
      
 243 
     | 
    
         
            +
                    template_location = template_location[0..-2] if template_location.end_with? File::SEPARATOR
         
     | 
| 
       239 
244 
     | 
    
         
             
                    return Cfhighlander::Model::TemplateMetadata.new(
         
     | 
| 
       240 
245 
     | 
    
         
             
                        template_name: template_name,
         
     | 
| 
       241 
246 
     | 
    
         
             
                        template_version: template_version,
         
     | 
| 
         @@ -1,4 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'yaml'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'securerandom'
         
     | 
| 
       2 
3 
     | 
    
         | 
| 
       3 
4 
     | 
    
         
             
            module Cfhighlander
         
     | 
| 
       4 
5 
     | 
    
         | 
| 
         @@ -131,6 +132,7 @@ module Cfhighlander 
     | 
|
| 
       131 
132 
     | 
    
         
             
                    @config['component_name'] = @name
         
     | 
| 
       132 
133 
     | 
    
         
             
                    @config['template_name'] = @template.template_name
         
     | 
| 
       133 
134 
     | 
    
         
             
                    @config['template_version'] = @template.template_version
         
     | 
| 
      
 135 
     | 
    
         
            +
                    @config['template_dir'] = @template.template_location
         
     | 
| 
       134 
136 
     | 
    
         | 
| 
       135 
137 
     | 
    
         
             
                    Dir[candidate_mappings_path].each do |mapping_file|
         
     | 
| 
       136 
138 
     | 
    
         
             
                      mappings = YAML.load(File.read(mapping_file))
         
     | 
| 
         @@ -188,11 +190,17 @@ module Cfhighlander 
     | 
|
| 
       188 
190 
     | 
    
         | 
| 
       189 
191 
     | 
    
         
             
                      # extend cfndsl, first comes parent, than child
         
     | 
| 
       190 
192 
     | 
    
         
             
                      # this allows for child component to shadow parent component
         
     | 
| 
       191 
     | 
    
         
            -
                      # defined resources
         
     | 
| 
      
 193 
     | 
    
         
            +
                      # defined resources. While cfhl evaluation will use parent's template_dir configuration
         
     | 
| 
      
 194 
     | 
    
         
            +
                      # value, for cfndsl, as this is lower level, will resolve in child component template_dir configuration
         
     | 
| 
      
 195 
     | 
    
         
            +
                      # we need to ensure both parent and child components have access to their template_dir variables
         
     | 
| 
      
 196 
     | 
    
         
            +
                      new_template_dir_var = "template_dir_#{SecureRandom.hex[0..8]}"
         
     | 
| 
      
 197 
     | 
    
         
            +
                      extended_component.cfndsl_content.gsub!('template_dir', new_template_dir_var)
         
     | 
| 
      
 198 
     | 
    
         
            +
                      @config[new_template_dir_var] = extended_component.template.template_location
         
     | 
| 
       192 
199 
     | 
    
         
             
                      @cfndsl_content = extended_component.cfndsl_content + @cfndsl_content
         
     | 
| 
       193 
200 
     | 
    
         | 
| 
       194 
201 
     | 
    
         
             
                      @parent_dsl = extended_component.highlander_dsl
         
     | 
| 
       195 
202 
     | 
    
         | 
| 
      
 203 
     | 
    
         
            +
                      # in case of hldsl or cfndsl refering to template_dir
         
     | 
| 
       196 
204 
     | 
    
         
             
                    end
         
     | 
| 
       197 
205 
     | 
    
         
             
                  end
         
     | 
| 
       198 
206 
     | 
    
         | 
| 
         @@ -221,7 +229,6 @@ module Cfhighlander 
     | 
|
| 
       221 
229 
     | 
    
         
             
                      cfhl_script += ("\n#{key} = #{val.inspect}\n")
         
     | 
| 
       222 
230 
     | 
    
         
             
                    end
         
     | 
| 
       223 
231 
     | 
    
         
             
                    cfhl_script += File.read(@highlander_dsl_path)
         
     | 
| 
       224 
     | 
    
         
            -
             
     | 
| 
       225 
232 
     | 
    
         
             
                    cfhl_dsl = eval(cfhl_script, binding)
         
     | 
| 
       226 
233 
     | 
    
         
             
                    if not cfhl_dsl.extended_template.nil?
         
     | 
| 
       227 
234 
     | 
    
         
             
                      @parent_template = cfhl_dsl.extended_template
         
     | 
| 
         @@ -239,6 +246,7 @@ module Cfhighlander 
     | 
|
| 
       239 
246 
     | 
    
         
             
                    @cfn_model = value.as_json
         
     | 
| 
       240 
247 
     | 
    
         
             
                    @cfn_model_raw = JSON.parse(@cfn_model.to_json)
         
     | 
| 
       241 
248 
     | 
    
         
             
                  end
         
     | 
| 
      
 249 
     | 
    
         
            +
             
     | 
| 
       242 
250 
     | 
    
         
             
                  def eval_cfndsl
         
     | 
| 
       243 
251 
     | 
    
         
             
                    compiler = Cfhighlander::Compiler::ComponentCompiler.new self
         
     | 
| 
       244 
252 
     | 
    
         
             
                    compiler.lambda_mock_resolve = true
         
     | 
    
        data/lib/cfhighlander.version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: cfhighlander
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.12.0.alpha.1586682642
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Nikola Tosic
         
     | 
| 
         @@ -10,7 +10,7 @@ authors: 
     | 
|
| 
       10 
10 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       11 
11 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       12 
12 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       13 
     | 
    
         
            -
            date: 2020-04- 
     | 
| 
      
 13 
     | 
    
         
            +
            date: 2020-04-12 00:00:00.000000000 Z
         
     | 
| 
       14 
14 
     | 
    
         
             
            dependencies:
         
     | 
| 
       15 
15 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       16 
16 
     | 
    
         
             
              name: highline
         
     | 
| 
         @@ -277,9 +277,9 @@ required_ruby_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       277 
277 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       278 
278 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       279 
279 
     | 
    
         
             
              requirements:
         
     | 
| 
       280 
     | 
    
         
            -
              - - " 
     | 
| 
      
 280 
     | 
    
         
            +
              - - ">"
         
     | 
| 
       281 
281 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       282 
     | 
    
         
            -
                  version:  
     | 
| 
      
 282 
     | 
    
         
            +
                  version: 1.3.1
         
     | 
| 
       283 
283 
     | 
    
         
             
            requirements: []
         
     | 
| 
       284 
284 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       285 
285 
     | 
    
         
             
            rubygems_version: 2.7.7
         
     |