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