output
This commit is contained in:
parent
350af4c943
commit
2fd887d40a
|
@ -55,7 +55,7 @@ module.exports = (robot) ->
|
||||||
|
|
||||||
if pv
|
if pv
|
||||||
d = deploy directory, pv, commands, target, program
|
d = deploy directory, pv, commands, target, program
|
||||||
res.reply d
|
res.send d
|
||||||
else
|
else
|
||||||
res.reply "Not a SVN or GIT repository"
|
res.reply "Not a SVN or GIT repository"
|
||||||
catch e
|
catch e
|
||||||
|
@ -127,14 +127,26 @@ deploy = (directory, projectVersionning, commands, target, program) ->
|
||||||
output = ""
|
output = ""
|
||||||
|
|
||||||
for stmt in results
|
for stmt in results
|
||||||
status = if stmt.status == 0 then 'OK' else 'KO'
|
output += generateOutput stmt
|
||||||
output += "`#{stmt.command}` is *#{status}*\n"
|
|
||||||
|
|
||||||
if stmt.status != 0
|
|
||||||
output += "\n```#{stmt.stdout} #{stmt.stderr}```"
|
|
||||||
|
|
||||||
output
|
output
|
||||||
|
|
||||||
|
generateOutput = (stmt) ->
|
||||||
|
prefix = "deploy-" + Date.now()
|
||||||
|
status =
|
||||||
|
if stmt.status == 0
|
||||||
|
"<span color='green'>OK</span>"
|
||||||
|
else
|
||||||
|
"<span color='red'>Failed</span>"
|
||||||
|
"""
|
||||||
|
<p><pre>#{stmt.command}</pre> #{status}</p>
|
||||||
|
<div>
|
||||||
|
Outputs: <a href="#" onclick="var e = document.getElementById('#{prefix}-stdout'); if (e.getAttribute('data-show') == 0) {e.style.display = 'block'; e.setAttribute('data-show', '1');} else {e.display = 'none'; e.setAttribute('data-show', '0');}">STDOUT</a> <a href="#" onclick="var e = document.getElementById('#{prefix}-stderr'); if (e.getAttribute('data-show') == 0) {e.style.display = 'block'; e.setAttribute('data-show', '1');} else {e.display = 'none'; e.setAttribute('data-show', '0');}">STDERR</a>
|
||||||
|
<pre id="#{prefix}-stdout" data-show="0" style="display: none">#{stmt.stdout}</pre>
|
||||||
|
<pre id="#{prefix}-stderr" data-show="0" style="display: none">#{stmt.stderr}</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
buildDeployCommand = (directory, program, target) ->
|
buildDeployCommand = (directory, program, target) ->
|
||||||
if program == 'mage'
|
if program == 'mage'
|
||||||
|
|
Loading…
Reference in a new issue