class PowerStencil::Project::Base

Attributes

engine[R]
entity_engine[R]

Public Class Methods

instantiate_from_config(config) click to toggle source
# File lib/power_stencil/project/base.rb, line 24
def instantiate_from_config(config)
  path = config[:'project-path'] || Dir.pwd
  new search_from_path: path
end
new(search_from_path: Dir.pwd) click to toggle source
# File lib/power_stencil/project/base.rb, line 48
def initialize(search_from_path: Dir.pwd)
  initialize_paths search_from_path
  load_project_specific_config
  check_project_version
  bootstrap_plugins
  build_engines
  register_system_templates_templates
  register_plugins_templates_templates
  register_project_templates_templates
  setup_git_tracking
end

Public Instance Methods

name() click to toggle source
# File lib/power_stencil/project/base.rb, line 44
def name
  File.dirname project_config_root
end

Private Instance Methods

build_engines() click to toggle source
# File lib/power_stencil/project/base.rb, line 91
def build_engines
  @engine = PowerStencil::Engine::ProjectEngine.new self
  @entity_engine = PowerStencil::Engine::EntityEngine.new
end
register_plugins_templates_templates() click to toggle source
# File lib/power_stencil/project/base.rb, line 62
def register_plugins_templates_templates
  plugins.each do |_, plugin|
    plugin.register_plugin_templates_templates
  end
end
register_project_templates_templates() click to toggle source
# File lib/power_stencil/project/base.rb, line 69
def register_project_templates_templates
  dir = project_templates_templates_path
  if Dir.exist? dir and File.readable? dir
    logger.info 'Registering project specific templates.'
    Dir.entries(dir).each do |potential_entity_type|
      next if potential_entity_type.match /^\./
      template_dir = File.join(dir, potential_entity_type)
      next unless File.directory? template_dir
      register_template_template_path_for_type potential_entity_type.to_sym, template_dir
    end
  end
end
register_system_templates_templates() click to toggle source
# File lib/power_stencil/project/base.rb, line 82
def register_system_templates_templates
  logger.debug 'Registering system templates'
  %i(plugin_definition simple_exec).each do |template_name|
    template_path = system_template_template_path template_name
    register_template_template_path_for_type template_name, template_path
  end
end