Class: Nanoc::Extra::Deployer Abstract

Inherits:
Object
  • Object
show all
Extended by:
PluginRegistry::PluginMethods
Defined in:
lib/nanoc/extra/deployer.rb

Overview

This class is abstract.

Subclass and override #run to implement a custom filter.

Represents a deployer, an object that allows uploading the compiled site to a specific (remote) location.

Direct Known Subclasses

Nanoc::Extra::Deployers::Fog, Nanoc::Extra::Deployers::Rsync

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Methods included from PluginRegistry::PluginMethods

all, identifier, identifiers, named, register

Constructor Details

- (Hash) initialize(source_path, config, params = {})

Returns config The deployer configuration

Parameters:

  • source_path (String)

    The path to the directory that contains the files to upload. It should not have a trailing slash.

  • params (Hash) (defaults to: {})

    a customizable set of options

Options Hash (params):

  • :dry_run (Boolean) — default: false

    true if the deployer should only show what would be deployed instead actually deploying



32
33
34
35
36
# File 'lib/nanoc/extra/deployer.rb', line 32

def initialize(source_path, config, params = {})
  @source_path  = source_path
  @config       = config
  @dry_run      = params.fetch(:dry_run) { false }
end

Instance Attribute Details

- (Hash) config (readonly)

Returns The deployer configuration

Returns:

  • (Hash)

    The deployer configuration



18
19
20
# File 'lib/nanoc/extra/deployer.rb', line 18

def config
  @config
end

- (Boolean) dry_run (readonly) Also known as: dry_run?

Returns true if the deployer should only show what would be deployed instead of doing the actual deployment

Returns:

  • (Boolean)

    true if the deployer should only show what would be deployed instead of doing the actual deployment



22
23
24
# File 'lib/nanoc/extra/deployer.rb', line 22

def dry_run
  @dry_run
end

- (String) source_path (readonly)

Returns The path to the directory that contains the files to upload. It should not have a trailing slash.

Returns:

  • (String)

    The path to the directory that contains the files to upload. It should not have a trailing slash.



15
16
17
# File 'lib/nanoc/extra/deployer.rb', line 15

def source_path
  @source_path
end

Instance Method Details

- (Object) run

This method is abstract.

Performs the actual deployment.

Raises:

  • (NotImplementedError)


41
42
43
# File 'lib/nanoc/extra/deployer.rb', line 41

def run
  raise NotImplementedError.new('Nanoc::Extra::Deployer subclasses must implement #run')
end