Top Level Namespace

Defined Under Namespace

Modules: CfHighlander, Cfhighlander Classes: Hash

Constant Summary collapse

LOCAL_CFHIGHLANDER_CACHE_LOCATION =
"#{ENV['HOME']}/.cfhighlander/components"

Instance Method Summary collapse

Instance Method Details

#CfhighlanderComponent(&block) ⇒ Object



539
540
541
542
# File 'lib/cfhighlander.dsl.template.rb', line 539

def CfhighlanderComponent(&block)
  STDERR.puts("DEPRECATED: #{@template.template_name}: use CfhighlanderTemplate instead of CfhighlanderComponent")
  CfhighlanderTemplate(&block)
end

#CfhighlanderTemplate(&block) ⇒ Object



473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
# File 'lib/cfhighlander.dsl.template.rb', line 473

def CfhighlanderTemplate(&block)

  if @parent_dsl.nil?
    instance = Cfhighlander::Dsl::HighlanderTemplate.new
    puts "Processing highlander component #{@name}\n\tLocation:#{@highlander_dsl_path}" +
        "\n\tConfig:#{@config}"
  else
    instance = @parent_dsl
    puts "Processing highlander component #{@name}\n\tLocation:#{@highlander_dsl_path}" +
        "\n\tConfig:#{@config}\n\tParent: #{@parent_template}"
  end

  instance.config = @config

  @mappings.each do |key, val|
    instance.addMapping(key, val)
  end

  unless @version.nil?
    instance.version = @version
    instance.config['component_version'] = @version
  end


  instance.name = @template.template_name
  instance.template_dir = @template.template_location
  instance.instance_eval(&block)

  unless @distribution_bucket.nil?
    instance.DistributionBucket(@distribution_bucket)
  end
  unless @distribution_prefix.nil?
    instance.DistributionPrefix(@distribution_prefix)
  end

  # process convention over configuration componentname.config.yaml files
  config_loader = Cfhighlander::Config::Loader.new

  @potential_subcomponent_overrides.each do |name, config|

    # if there is component with given file name
    first_component = name.split('.').first
    if (not instance.subcomponents.find { |s| s.name == first_component }.nil?)
      instance.config['components'] = {} unless instance.config.key? 'components'
      instance.config['components'][name] = {} unless instance.config['components'].key? name
      instance.config['components'][name]['config'] = {} unless instance.config['components'][name].key? 'config'

      # prevention of infinite recursion when applied to legacy configurations
      if config.key? 'components'
        if config['components'].key? name
          if config['components'][name].key? 'config'
            # old legacy format takes priority, but these can be mixed
            config.extend config['components'][name]['config']
          end
        end
      end
      instance.config.extend(config_loader.get_nested_config(name, config))
    end
  end

  # load sub-components
  instance.loadComponents

  return instance
end

#HighlanderComponent(&block) ⇒ Object



544
545
546
547
# File 'lib/cfhighlander.dsl.template.rb', line 544

def HighlanderComponent(&block)
  STDERR.puts("DEPRECATED: #{@template.template_name}: use CfhighlanderTemplate instead of HighlanderComponent")
  CfhighlanderTemplate(&block)
end