Class: Sprinkle::Actors::Vlad

Inherits:
Object
  • Object
show all
Defined in:
lib/sprinkle/actors/vlad.rb

Overview

Vlad Delivery Method

Vlad is one of the delivery method options available out of the box with Sprinkle. If you have the vlad the deployer gem install, you may use this delivery. The only configuration option available, and which is mandatory to include is script. An example:

deployment do
  delivery :vlad do
    script 'deploy'
  end
end

script is given a list of files which vlad will include and load. These recipes are mainly to set variables such as :user, :password, and to set the app domain which will be sprinkled.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Vlad

:nodoc:



23
24
25
# File 'lib/sprinkle/actors/vlad.rb', line 23

def initialize(&block) #:nodoc:
  self.instance_eval &block if block
end

Instance Attribute Details

#loaded_recipesObject

:nodoc:



21
22
23
# File 'lib/sprinkle/actors/vlad.rb', line 21

def loaded_recipes
  @loaded_recipes
end

Instance Method Details

#process(name, commands, roles, suppress_and_return_failures = false) ⇒ Object

:nodoc:



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/sprinkle/actors/vlad.rb', line 43

def process(name, commands, roles, suppress_and_return_failures = false) #:nodoc:
  commands = Array(commands)
  if use_sudo
    commands = commands.map{|x| "sudo #{x}"}
  end
  commands = commands.join(' && ')
  puts "executing #{commands}"
  t = remote_task(task_sym(name), :roles => roles) { run commands }
  
  begin
    t.invoke
    return true
  rescue ::Rake::CommandFailedError => e
    return false if suppress_and_return_failures
    
    # Reraise error if we're not suppressing it
    raise
  end
end

#script(name) ⇒ Object

Defines a script file which will be included by vlad. Use these script files to set vlad specific configurations. Multiple scripts may be specified through multiple script calls, an example:

deployment do
  delivery :vlad do
    script 'deploy'
    script 'magic_beans'
  end
end


37
38
39
40
41
# File 'lib/sprinkle/actors/vlad.rb', line 37

def script(name)
  @loaded_recipes ||= []
  require name
  @loaded_recipes << name
end

#transfer(name, source, destination, roles, recursive = true, suppress_and_return_failures = false) ⇒ Object

Sorry, all transfers are recursive



64
65
66
67
68
69
70
71
72
73
74
# File 'lib/sprinkle/actors/vlad.rb', line 64

def transfer(name, source, destination, roles, recursive = true, suppress_and_return_failures = false) #:nodoc:
  begin
          rsync source, destination
    return true
  rescue ::Rake::CommandFailedError => e
    return false if suppress_and_return_failures
    
    # Reraise error if we're not suppressing it
    raise
  end
end