output
This commit is contained in:
parent
4fb251d788
commit
350af4c943
|
@ -54,7 +54,8 @@ module.exports = (robot) ->
|
|||
catch e
|
||||
|
||||
if pv
|
||||
deploy directory, pv, commands, target, program
|
||||
d = deploy directory, pv, commands, target, program
|
||||
res.reply d
|
||||
else
|
||||
res.reply "Not a SVN or GIT repository"
|
||||
catch e
|
||||
|
@ -88,18 +89,52 @@ class GitProjectVersionning extends ProjectVersionning
|
|||
|
||||
logExec = (command, options) ->
|
||||
exec = require "sync-exec"
|
||||
|
||||
console.log command
|
||||
exec command, options
|
||||
|
||||
|
||||
deploy = (directory, projectVersionning, commands, target, program) ->
|
||||
commands = projectVersionning.getUpdateCommands().concat(commands)
|
||||
canDeploy = true
|
||||
results = []
|
||||
|
||||
for command in commands
|
||||
logExec command , {cwd: directory}
|
||||
if !canDeploy
|
||||
continue
|
||||
|
||||
stmt = logExec command , {cwd: directory}
|
||||
|
||||
results.push {
|
||||
command: command,
|
||||
status: stmt.status,
|
||||
stdout: stmt.stdout,
|
||||
stderr: stmt.stderr,
|
||||
}
|
||||
|
||||
if stmt.status != 0
|
||||
canDeploy = false
|
||||
|
||||
if canDeploy
|
||||
command = buildDeployCommand(directory, program, target)
|
||||
stmt = logExec command, {cwd: directory}
|
||||
|
||||
results.push {
|
||||
command: command,
|
||||
status: stmt.status,
|
||||
stdout: stmt.stdout,
|
||||
stderr: stmt.stderr,
|
||||
}
|
||||
|
||||
output = ""
|
||||
|
||||
for stmt in results
|
||||
status = if stmt.status == 0 then 'OK' else 'KO'
|
||||
output += "`#{stmt.command}` is *#{status}*\n"
|
||||
|
||||
if stmt.status != 0
|
||||
output += "\n```#{stmt.stdout} #{stmt.stderr}```"
|
||||
|
||||
output
|
||||
|
||||
logExec buildDeployCommand(directory, program, target), {cwd: directory}
|
||||
|
||||
buildDeployCommand = (directory, program, target) ->
|
||||
if program == 'mage'
|
||||
|
|
Loading…
Reference in a new issue