commit bf6c5e61961ad5e60d95317cba7d5c9f5ae58f48 Author: Simon Vieille Date: Thu Jan 21 13:52:05 2016 +0100 init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1377554 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.swp diff --git a/deployment.coffee b/deployment.coffee new file mode 100644 index 0000000..1c3f8a1 --- /dev/null +++ b/deployment.coffee @@ -0,0 +1,26 @@ +# Description: +# Deployment script +# +# Commands: +# hubot deploy [from branch ] to [after [, , ...]] +# +# URLS: +# +# Notes: +# + +module.exports = (robot) -> + robot.hear /deploy ([^\s]+)( from branch ([^\s]+))? to ([^\s]+)( after (.*))?$/i, (res) -> + project = res.match[1] + environnement = res.match[4] + branch = if res.match[3] then res.match[3] else null + commands = if res.match[6] then cleanCommands res.match[6].split(',') else [] + +cleanCommands = (commands) -> + results = [] + commands = commands.map(Function.prototype.call, String.prototype.trim) + + for command in commands + results.push(command) if command != '' + + results