Class: Sprinkle::Actors::Local

Inherits:
Actor show all
Defined in:
lib/sprinkle/actors/local.rb

Overview

The local actor executes all commands on your local system, as opposed to other implementations that generally run commands on a remote system over the network.

This could be useful if you'd like to use Sprinkle to provision your local machine. To enable this actor, in your Sprinkle script specify the :local delivery mechanism.

deployment do
  delivery :local
end

Note: The local actor completely ignores roles and behaves as if your local system was a member of all roles defined.

Defined Under Namespace

Classes: LocalCommandError

Instance Method Summary collapse

Instance Method Details

#install(installer, roles, opts = {}) ⇒ Object

:nodoc:


34
35
36
37
38
39
40
41
42
# File 'lib/sprinkle/actors/local.rb', line 34

def install(installer, roles, opts = {}) #:nodoc:
  # all local installer cares about is the commands
  @installer = installer
  process(installer.package.name, installer.install_sequence, roles)
rescue LocalCommandError => e
  raise_error(e)
ensure
  @installer = nil
end

#servers_for_role?(role) ⇒ Boolean

:nodoc:

Returns:

  • (Boolean)

25
26
27
# File 'lib/sprinkle/actors/local.rb', line 25

def servers_for_role?(role) #:nodoc:
  true
end

#sudo?Boolean

:nodoc:;

Returns:

  • (Boolean)

29
30
# File 'lib/sprinkle/actors/local.rb', line 29

def sudo? #:nodoc:; 
false; end

#sudo_commandObject

:nodoc:;


31
32
# File 'lib/sprinkle/actors/local.rb', line 31

def sudo_command #:nodoc:; 
nil; end

#verify(verifier, roles, opts = {}) ⇒ Object

:nodoc:


44
45
46
47
48
49
# File 'lib/sprinkle/actors/local.rb', line 44

def verify(verifier, roles, opts = {}) #:nodoc:
  process(verifier.package.name, verifier.commands, roles)
  true
rescue LocalCommandError
  false
end