module PowerStencil::Project::Paths

Attributes

project_config_root[R]
started_from[R]

Public Class Methods

project_system_template_template_path() click to toggle source
# File lib/power_stencil/project/paths.rb, line 14
def self.project_system_template_template_path
  File.join system_templates_templates_path, 'project'
end
system_templates_templates_path() click to toggle source
# File lib/power_stencil/project/paths.rb, line 10
def self.system_templates_templates_path
  File.expand_path File.join('..', '..', '..', '..', 'etc', 'templates'), __FILE__
end

Public Instance Methods

build_root_path() click to toggle source
# File lib/power_stencil/project/paths.rb, line 30
def build_root_path
  File.join project_root, PowerStencil.config[:project_build_root_directory_name]
end
build_run_path(seed) click to toggle source
# File lib/power_stencil/project/paths.rb, line 18
def build_run_path(seed)
  File.join build_root_path, timestamped_uniq_dir(seed, Time.now)
end
config_directory_name() click to toggle source
# File lib/power_stencil/project/paths.rb, line 102
def config_directory_name
  @config_directory_name ||= PowerStencil.config[:default_config_directory_name]
end
config_directory_name=(new_name) click to toggle source
# File lib/power_stencil/project/paths.rb, line 106
def config_directory_name=(new_name)
  @config_directory_name = new_name
  initialize_paths started_from unless started_from.nil?
end
entities_template_path() click to toggle source
# File lib/power_stencil/project/paths.rb, line 50
def entities_template_path
  File.join project_root, PowerStencil.config[:versioned_entities_templates_directory_name]
end
entity_template_path(entity) click to toggle source
# File lib/power_stencil/project/paths.rb, line 58
def entity_template_path(entity)
  if entity.is_versioned_entity?
    File.join entities_template_path, entity.type.to_s, entity.name
  else
    File.join user_entities_template_path, entity.type.to_s, entity.name
  end
end
find_project_root(from_path) click to toggle source
# File lib/power_stencil/project/paths.rb, line 119
def find_project_root(from_path)
  find_recursively_in_path config_directory_name, from_path
end
initialize_paths(from_path) click to toggle source
# File lib/power_stencil/project/paths.rb, line 111
def initialize_paths(from_path)
  from_path = File.expand_path from_path
  @project_config_root = find_project_root from_path
  raise PowerStencil::Error, "Cannot find a project in '#{from_path}' !" unless project_root_setup?
  @started_from = project_config_root.nil? ? nil : from_path
  project_root
end
project_entities_path() click to toggle source
# File lib/power_stencil/project/paths.rb, line 78
def project_entities_path
  File.join project_config_root, PowerStencil.config[:project_entities_directory_name]
end
project_entity_definitions_path() click to toggle source
# File lib/power_stencil/project/paths.rb, line 66
def project_entity_definitions_path
  File.join project_config_root, PowerStencil.config[:project_entity_definitions_directory_name]
end
project_entity_path(entity) click to toggle source
# File lib/power_stencil/project/paths.rb, line 70
def project_entity_path(entity)
  File.join project_entities_path, entity.type.to_s, "#{entity.name}.yaml"
end
project_local_plugin_path(plugin_name) click to toggle source
# File lib/power_stencil/project/paths.rb, line 42
def project_local_plugin_path(plugin_name)
  File.join project_local_plugins_path, plugin_name
end
project_local_plugins_path() click to toggle source
# File lib/power_stencil/project/paths.rb, line 38
def project_local_plugins_path
  File.join project_config_root, PowerStencil.config[:project_plugins_directory_name]
end
project_personal_config_file() click to toggle source
# File lib/power_stencil/project/paths.rb, line 98
def project_personal_config_file
  File.join project_config_root, PowerStencil.config[:unversioned_user_project_config_file_name]
end
project_root() click to toggle source
# File lib/power_stencil/project/paths.rb, line 90
def project_root
  File.expand_path '..', project_config_root
end
project_root_setup?() click to toggle source
# File lib/power_stencil/project/paths.rb, line 86
def project_root_setup?
  not project_config_root.nil?
end
project_templates_templates_path() click to toggle source
# File lib/power_stencil/project/paths.rb, line 46
def project_templates_templates_path
  File.join project_config_root, PowerStencil.config[:project_templates_directory_name]
end
project_versioned_config_file() click to toggle source
# File lib/power_stencil/project/paths.rb, line 94
def project_versioned_config_file
  File.join project_config_root, PowerStencil.config[:versioned_project_config_file_name]
end
system_template_template_path(entity_type) click to toggle source
# File lib/power_stencil/project/paths.rb, line 34
def system_template_template_path(entity_type)
  File.join PowerStencil::Project::Paths.system_templates_templates_path, entity_type.to_s
end
user_entities_path() click to toggle source
# File lib/power_stencil/project/paths.rb, line 82
def user_entities_path
  File.join project_config_root, PowerStencil.config[:user_entities_directory_name]
end
user_entities_template_path() click to toggle source
# File lib/power_stencil/project/paths.rb, line 54
def user_entities_template_path
  File.join project_root, PowerStencil.config[:unversioned_user_entities_templates_directory_name]
end
user_entity_path(entity) click to toggle source
# File lib/power_stencil/project/paths.rb, line 74
def user_entity_path(entity)
  File.join user_entities_path, entity.type.to_s, "#{entity.name}.yaml"
end