Class: KBuilder::Configuration

Inherits:
BaseConfiguration show all
Includes:
KLog::Logging
Defined in:
lib/k_builder/configuration.rb

Overview

Does this class need to move out into k_types? It is being used with k_manager in a similar fashion

Configuration class

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseConfiguration

attach_config_to_parent, #basic_type?, #complex_type?, #kv, #to_h

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



41
42
43
44
45
46
47
48
# File 'lib/k_builder/configuration.rb', line 41

def initialize
  super
  # @target_folder = Dir.getwd
  # @template_folder = File.join(Dir.getwd, '.templates')
  # @global_template_folder = nil
  @target_folders = KType::NamedFolders.new
  @template_folders = KType::LayeredFolders.new
end

Instance Attribute Details

#target_foldersObject

Target folders provide a set named folders that can be written to



36
37
38
# File 'lib/k_builder/configuration.rb', line 36

def target_folders
  @target_folders
end

#template_foldersObject

Template folders provides layered folders that templates can exist within



39
40
41
# File 'lib/k_builder/configuration.rb', line 39

def template_folders
  @template_folders
end

Instance Method Details

#debug(heading: 'kbuilder base configuration') ⇒ Object



57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/k_builder/configuration.rb', line 57

def debug(heading: 'kbuilder base configuration')
  log.section_heading 'kbuilder base configuration' if heading

  # TODO: Add name to configuration object
  # Don't have support for name on the configuration object yet
  # log.kv 'config name', name

  target_folders.debug(title: 'target_folders')

  # log.info ''

  template_folders.debug(title: 'template folders (search order)')
  ''
end

#initialize_copy(orig) ⇒ Object



50
51
52
53
54
55
# File 'lib/k_builder/configuration.rb', line 50

def initialize_copy(orig)
  super(orig)

  @target_folders = orig.target_folders.clone
  @template_folders = orig.template_folders.clone
end