module PowerStencil::Plugins::Require

Constants

POST_BUILD_HOOK

Public Instance Methods

require_entry_point() click to toggle source
# File lib/power_stencil/plugins/require.rb, line 10
def require_entry_point
  @entry_point_path = File.join plugin_path, 'lib', "#{name.underscore}.rb"
  logger.debug "Plugin '#{name}' entry point: '#{entry_point_path}'"
  plugin_root_path = File.dirname(entry_point_path)
  begin
    $LOAD_PATH << plugin_root_path
    securely_require entry_point_path unless plugin_definition[:plugin_module].nil?
  rescue LoadError => e
    @entry_point_path = nil
    logger.warn "As plugin '#{name}' code is invalid, removing '#{plugin_root_path}' from LOAD_PATH"
    $LOAD_PATH.delete plugin_root_path
  end
end

Private Instance Methods

module_short_name() click to toggle source
# File lib/power_stencil/plugins/require.rb, line 26
def module_short_name
  name.split(/[-_]+/).map(&:capitalize).join.to_sym
end
setup_version() click to toggle source
# File lib/power_stencil/plugins/require.rb, line 30
def setup_version
  @version = PowerStencil::Utils::SemanticVersion.new plugin_module::VERSION
  capabilities[:version] = true
  logger.debug "Plugin '#{name}' is in version: #{version}"
rescue
  logger.warn "No version specified for plugin '#{name}'."
end