Class: AutomateIt::Plugin::Base

Inherits:
Common show all
Defined in:
lib/automateit/plugin/base.rb

Overview

Plugin::Base

An AutomateIt Plugin provides the Interpreter with the functionality that users actually care about, such as installing packages or adding users. The Plugin::Base class isn’t useful by itself but provides behavior that’s inherited by the Plugin::Manager and Plugin::Driver classes.

Direct Known Subclasses

Driver, Manager

Constant Summary

Constants included from Constants

Constants::HELPERS_DIR, Constants::INSTALL_DIR, Constants::PERROR, Constants::PEXEC, Constants::PNOTE, Constants::WARNING_BOILERPLATE

Instance Attribute Summary

Attributes inherited from Common

#interpreter

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Common

#initialize, #log, #nitpick, #noop, #noop=, #noop?, #preview, #preview=, #preview?, #preview_for, #superuser?, #writing, #writing=, #writing?

Constructor Details

This class inherits a constructor from AutomateIt::Common

Class Method Details

.tokenObject

See #token.



27
28
29
# File 'lib/automateit/plugin/base.rb', line 27

def self.token
  return to_s.demodulize.underscore.to_sym
end

Instance Method Details

#setup(opts = {}) ⇒ Object

:nodoc:



10
11
12
13
14
# File 'lib/automateit/plugin/base.rb', line 10

def setup(opts={}) # :nodoc:
  super(opts)
  @interpreter ||= opts[:interpreter] \
    || AutomateIt::Interpreter.new(:parent => self)
end

#tokenObject

Get token for the plugin. The token is a symbol that represents the classname of the underlying object.

Example:

AddressManager.token # => :address_manager
AddressManager::Portable.token => :portable


22
23
24
# File 'lib/automateit/plugin/base.rb', line 22

def token
  self.class.token
end