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



524
525
526
527
# File 'lib/cfhighlander.dsl.template.rb', line 524

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

#CfhighlanderTemplate(&block) ⇒ Object



459
460
461
462
463
464
465
466
467
468
469
470
471
472
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
# File 'lib/cfhighlander.dsl.template.rb', line 459

def CfhighlanderTemplate(&block)

  if @parent_dsl.nil?
    instance = Cfhighlander::Dsl::HighlanderTemplate.new
    puts "Processing higlander component #{@name}\n\tLocation:#{@highlander_dsl_path}" +
        "\n\tConfig:#{@config}"
  else
    instance = @parent_dsl
    puts "Processing higlander 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.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



529
530
531
532
# File 'lib/cfhighlander.dsl.template.rb', line 529

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