lib/sprinkle/actors/vlad.rb in sprinkle-0.3.1 vs lib/sprinkle/actors/vlad.rb in sprinkle-0.3.2
- old
+ new
@@ -11,11 +11,11 @@
# delivery :vlad do
# script 'deploy'
# end
# end
#
- # script is given a list of files which capistrano will include and load.
+ # 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.
class Vlad
require 'vlad'
attr_accessor :loaded_recipes #:nodoc:
@@ -34,22 +34,27 @@
# script 'magic_beans'
# end
# end
def script(name)
@loaded_recipes ||= []
- self.load name
- @loaded_recipes << script
+ require name
+ @loaded_recipes << name
end
def process(name, commands, roles, suppress_and_return_failures = false) #:nodoc:
- commands = commands.join ' && ' if commands.is_a? Array
+ 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 ::Vlad::CommandFailedError => e
+ rescue ::Rake::CommandFailedError => e
return false if suppress_and_return_failures
# Reraise error if we're not suppressing it
raise
end
@@ -58,10 +63,10 @@
# Sorry, all transfers are recursive
def transfer(name, source, destination, roles, recursive = true, suppress_and_return_failures = false) #:nodoc:
begin
rsync source, destination
return true
- rescue ::Vlad::CommandFailedError => e
+ rescue ::Rake::CommandFailedError => e
return false if suppress_and_return_failures
# Reraise error if we're not suppressing it
raise
end