class Object

Constants

LOCAL_CFHIGHLANDER_CACHE_LOCATION

Public Instance Methods

CfhighlanderComponent(&block) click to toggle source
# 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) click to toggle source
# File lib/cfhighlander.dsl.template.rb, line 473
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.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) click to toggle source
# 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