Class AutomateIt::TemplateManager::BaseDriver
In: lib/automateit/template_manager/base.rb
Parent: AutomateIt::Plugin::Driver

TemplateManager::BaseDriver

Base class for all TemplateManager drivers.

Methods

_backup   _exists?   _mtime   _newer   _read   _render_helper   _write   setup  

Attributes

default_check  [RW]  Name of default algorithm for performing checks, e.g., :compare

Public Instance methods

Options:

  • :default_check - Set the default_check, e.g., :compare

Protected Instance methods

Backup filename.

Does filename exist?

Return the modification date for filename.

Return Array of dependencies newer than filename. Will be empty if filename is newer than all of the dependencies.

Return the contents of filename.

Render a template specified in the block. It takes the same arguments and returns the same results as the render call.

This method is used by the render methods for different template drivers and provides all the logic for parsing arguments, figuring out if a template should be rendered, what to do with the rendering, etc.

This method calls the supplied block with a hash containing:

  • :text — Template‘s text.
  • :filename — Template‘s filename, or nil if none. The template
  • :binder — Binding containing the locals as variables.
  • :locals — Hash of locals.
  • :opts — Hash of options passed to the _render_helper.

The supplied block must return the text of the rendered template.

See the TemplateManager::ERB#render method for a usage example.

Write contents to filename.

[Validate]