Deployment commands

This commit is contained in:
Simon Vieille 2016-01-21 16:38:31 +01:00
parent 8484ecc662
commit bd26e8cbfe

View file

@ -26,16 +26,20 @@ module.exports = (robot) ->
if err != null or !stats.isDirectory if err != null or !stats.isDirectory
return res.reply "Project not found [" + directory + "]" return res.reply "Project not found [" + directory + "]"
process.chdir(directory) try
fs.statSync directory + '/.svn'
fs.stat '.svn', (err, stats) -> pv = new SvnProjectVersionning branch
if err == null catch e
deploy new SvnProjectVersionning(branch), commands
fs.stat '.git', (err, stats) -> try
if err == null fs.statSync directory + '/.git'
deploy new GitProjectVersionning(branch), commands pv = new GitProjectVersionning branch
catch e
if pv
deploy directory, pv, commands
else
res.reply "Not a SVN or GIT repository"
catch e catch e
res.reply "Exception: " + e res.reply "Exception: " + e
@ -65,8 +69,12 @@ class GitProjectVersionning extends ProjectVersionning
commands commands
deploy = (projectVersionning, commands) -> deploy = (directory, projectVersionning, commands) ->
console.log projectVersionning.getUpdateCommands() exec = require('sync-exec');
commands = projectVersionning.getUpdateCommands().concat(commands)
for command in commands
exec command, {cwd: directory}
cleanCommands = (commands) -> cleanCommands = (commands) ->
results = [] results = []