output
This commit is contained in:
parent
4fb251d788
commit
350af4c943
|
@ -54,7 +54,8 @@ module.exports = (robot) ->
|
||||||
catch e
|
catch e
|
||||||
|
|
||||||
if pv
|
if pv
|
||||||
deploy directory, pv, commands, target, program
|
d = deploy directory, pv, commands, target, program
|
||||||
|
res.reply d
|
||||||
else
|
else
|
||||||
res.reply "Not a SVN or GIT repository"
|
res.reply "Not a SVN or GIT repository"
|
||||||
catch e
|
catch e
|
||||||
|
@ -88,18 +89,52 @@ class GitProjectVersionning extends ProjectVersionning
|
||||||
|
|
||||||
logExec = (command, options) ->
|
logExec = (command, options) ->
|
||||||
exec = require "sync-exec"
|
exec = require "sync-exec"
|
||||||
|
|
||||||
console.log command
|
|
||||||
exec command, options
|
exec command, options
|
||||||
|
|
||||||
|
|
||||||
deploy = (directory, projectVersionning, commands, target, program) ->
|
deploy = (directory, projectVersionning, commands, target, program) ->
|
||||||
commands = projectVersionning.getUpdateCommands().concat(commands)
|
commands = projectVersionning.getUpdateCommands().concat(commands)
|
||||||
|
canDeploy = true
|
||||||
|
results = []
|
||||||
|
|
||||||
for command in commands
|
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) ->
|
buildDeployCommand = (directory, program, target) ->
|
||||||
if program == 'mage'
|
if program == 'mage'
|
||||||
|
|
Loading…
Reference in a new issue