6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/deep_thought-capistrano_2/deployer/capistrano2.rb', line 6
def execute?(deploy, config)
environment = deploy.environment || "development"
cap_command = "cap #{environment} deploy"
if deploy.actions
actions = YAML.load(deploy.actions)
actions.each do |action|
cap_command += ":#{action}"
end
end
cap_command += " -s branch=#{deploy.branch}"
cap_command += " -s box=#{deploy.box}" if deploy.box
if deploy.variables
variables = YAML.load(deploy.variables)
variables.each do |k, v|
cap_command += " -s #{k}=#{v}"
end
end
commands = []
commands << "cd ./.projects/#{deploy.project.name}"
commands << "#{cap_command} 2>&1"
command = commands.join(" && ")
log = `#{command}`
deploy.log = log
$?.success?
end
|