class Cog::Plugin

Describes a plugin found on the {Config#plugin_path}. The plugin {DSL::Cogfile} will have already been processed, and should have contained a call to {DSL::Cogfile#autoload_plugin}, which will make it's DSL available to generators via a {GeneratorSandbox}.

Attributes

cogfile_path[R]

@return [String] path to the plugin's cogfile

name[R]

@return [String] name of the plugin

path[R]

@return [String] path to the plugin directory

stamp_generator_block[RW]

@return [Block] the block to use to stamp the generator

Public Class Methods

new(cogfile_path) click to toggle source

@param cogfile_path [String] path to the plugin Cogfile

# File lib/cog/plugin.rb, line 19
def initialize(cogfile_path)
  unless File.exists?(cogfile_path)
    raise Errors::InvalidPluginConfiguration.new :cogfile => cogfile_path
  end
  @cogfile_path = File.expand_path cogfile_path
  @path = File.dirname @cogfile_path
  @name = File.basename @path
  @name = $1 if /^(.+?)\-(\d|\.)+(rc2)?$/ =~ @name
end

Public Instance Methods

<=>(other) click to toggle source

Sort plugins by name

# File lib/cog/plugin.rb, line 30
def <=>(other)
  @name <=> other.name
end