lib/power_stencil/plugins/templates.rb in power_stencil-0.4.22 vs lib/power_stencil/plugins/templates.rb in power_stencil-0.5.0

- old
+ new

@@ -1,18 +1,20 @@ module PowerStencil module Plugins module Templates - SETUP_PLUGIN_TEMPLATES = :setup_plugin_templates - def register_plugin_templates - if plugin_module.respond_to? SETUP_PLUGIN_TEMPLATES - logger.debug "Plugin '#{name}' declares to have template(s)." - capabilities[:templates] = true - plugin_module.send SETUP_PLUGIN_TEMPLATES - else - logger.debug "Plugin '#{name}' declares to have no template." + return unless capabilities[:templates] + logger.info "Loading '#{self.name}' plugin templates..." + plugin_definition[:templates].each do |templates_path| + plugin_templates_path = File.join self.path, templates_path + Dir.entries(plugin_templates_path).reject { |e| %w(. ..).include? e }.each do |entry| + template_path = File.join(plugin_templates_path, entry) + if Dir.exist? template_path + project.register_template_path_for_type entry.to_sym, template_path + end + end end end end