|
beead266
»
|
crafterm |
2008-06-03 |
Add support for using Vlad ... |
1 |
module Sprinkle |
| |
2 |
module Actors |
|
33c10a3a
»
|
mitchellh |
2008-07-19 |
I've started documenting al... |
3 |
# = Vlad Delivery Method |
| |
4 |
# |
| |
5 |
# Vlad is one of the delivery method options available out of the |
| |
6 |
# box with Sprinkle. If you have the vlad the deployer gem install, you |
| |
7 |
# may use this delivery. The only configuration option available, and |
| |
8 |
# which is mandatory to include is +script+. An example: |
| |
9 |
# |
| |
10 |
# deployment do |
| |
11 |
# delivery :vlad do |
| |
12 |
# script 'deploy' |
| |
13 |
# end |
| |
14 |
# end |
| |
15 |
# |
| |
16 |
# script is given a list of files which capistrano will include and load. |
| |
17 |
# These recipes are mainly to set variables such as :user, :password, and to |
| |
18 |
# set the app domain which will be sprinkled. |
|
beead266
»
|
crafterm |
2008-06-03 |
Add support for using Vlad ... |
19 |
class Vlad |
| |
20 |
require 'vlad' |
|
33c10a3a
»
|
mitchellh |
2008-07-19 |
I've started documenting al... |
21 |
attr_accessor :loaded_recipes #:nodoc: |
|
beead266
»
|
crafterm |
2008-06-03 |
Add support for using Vlad ... |
22 |
|
|
33c10a3a
»
|
mitchellh |
2008-07-19 |
I've started documenting al... |
23 |
def initialize(&block) #:nodoc: |
|
beead266
»
|
crafterm |
2008-06-03 |
Add support for using Vlad ... |
24 |
self.instance_eval &block if block |
| |
25 |
end |
| |
26 |
|
|
33c10a3a
»
|
mitchellh |
2008-07-19 |
I've started documenting al... |
27 |
# Defines a script file which will be included by vlad. Use these |
| |
28 |
# script files to set vlad specific configurations. Multiple scripts |
| |
29 |
# may be specified through multiple script calls, an example: |
| |
30 |
# |
| |
31 |
# deployment do |
| |
32 |
# delivery :vlad do |
| |
33 |
# script 'deploy' |
| |
34 |
# script 'magic_beans' |
| |
35 |
# end |
| |
36 |
# end |
|
beead266
»
|
crafterm |
2008-06-03 |
Add support for using Vlad ... |
37 |
def script(name) |
| |
38 |
@loaded_recipes ||= [] |
| |
39 |
self.load name |
| |
40 |
@loaded_recipes << script |
| |
41 |
end |
| |
42 |
|
|
33c10a3a
»
|
mitchellh |
2008-07-19 |
I've started documenting al... |
43 |
def process(name, commands, roles, suppress_and_return_failures = false) #:nodoc: |
|
beead266
»
|
crafterm |
2008-06-03 |
Add support for using Vlad ... |
44 |
commands = commands.join ' && ' if commands.is_a? Array |
| |
45 |
t = remote_task(task_sym(name), :roles => roles) { run commands } |
|
8255114c
»
|
mitchellh |
2008-07-17 |
A slight change to actors s... |
46 |
|
| |
47 |
begin |
| |
48 |
t.invoke |
| |
49 |
return true |
| |
50 |
rescue ::Vlad::CommandFailedError => e |
| |
51 |
return false if suppress_and_return_failures |
| |
52 |
|
| |
53 |
# Reraise error if we're not suppressing it |
| |
54 |
raise |
| |
55 |
end |
|
beead266
»
|
crafterm |
2008-06-03 |
Add support for using Vlad ... |
56 |
end |
| |
57 |
|
|
f2c82abd
»
|
Jacob Harris |
2009-06-08 |
Added a new transfer instal... |
58 |
# Sorry, all transfers are recursive |
| |
59 |
def transfer(name, source, destination, roles, recursive = true, suppress_and_return_failures = false) #:nodoc: |
| |
60 |
begin |
| |
61 |
rsync source, destination |
| |
62 |
return true |
| |
63 |
rescue ::Vlad::CommandFailedError => e |
| |
64 |
return false if suppress_and_return_failures |
| |
65 |
|
| |
66 |
# Reraise error if we're not suppressing it |
| |
67 |
raise |
| |
68 |
end |
| |
69 |
end |
| |
70 |
|
|
beead266
»
|
crafterm |
2008-06-03 |
Add support for using Vlad ... |
71 |
private |
| |
72 |
|
| |
73 |
def task_sym(name) |
| |
74 |
"install_#{name.to_task_name}".to_sym |
| |
75 |
end |
| |
76 |
end |
| |
77 |
end |
| |
78 |
end |