Top Level Namespace

Defined Under Namespace

Modules: Cfhighlander

Constant Summary collapse

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

Instance Method Summary collapse

Instance Method Details

#CfhighlanderComponent(&block) ⇒ Object



517
518
519
520
# File 'lib/cfhighlander.dsl.template.rb', line 517

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

#CfhighlanderTemplate(&block) ⇒ Object



452
453
454
455
456
457
458
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
# File 'lib/cfhighlander.dsl.template.rb', line 452

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
  unless @distribution_format.nil?
    instance.Forma
  end

  # process convention over configuration componentname.config.yaml files
  @potential_subcomponent_overrides.each do |name, config|

    # if there is component with given file name
    if (not instance.subcomponents.find {|s| s.name == name}.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'
            config = config['components'][name]['config']
          end
        end
      end

      instance.config['components'][name]['config'].extend config
    end
  end

  # load sub-components
  instance.loadComponents

  return instance
end

#HighlanderComponent(&block) ⇒ Object



522
523
524
525
# File 'lib/cfhighlander.dsl.template.rb', line 522

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