projects directory
This commit is contained in:
parent
075380ec23
commit
4fb251d788
|
@ -10,15 +10,33 @@
|
||||||
#
|
#
|
||||||
fs = require 'fs'
|
fs = require 'fs'
|
||||||
|
|
||||||
|
deploymentDirectory = null
|
||||||
|
|
||||||
module.exports = (robot) ->
|
module.exports = (robot) ->
|
||||||
|
robot.hear /deploy set ([^\s]+) +(.+)$/i, (res) ->
|
||||||
|
if res.match[1] == "directory"
|
||||||
|
deploymentDirectory = res.match[2]
|
||||||
|
|
||||||
robot.hear /deploy +([^\s]+)( +with +([^\s]+))?( +from +branch +([^\s]+))? +to +([^\s]+)( +after (.*))?$/i, (res) ->
|
robot.hear /deploy +([^\s]+)( +with +([^\s]+))?( +from +branch +([^\s]+))? +to +([^\s]+)( +after (.*))?$/i, (res) ->
|
||||||
|
|
||||||
|
if ! process.env.hasOwnProperty('HUBO_DEPLOYMENT_PROJECTS_DIRECTORY')
|
||||||
|
if deploymentDirectory == null
|
||||||
|
res.reply "You must set the env var HUBO_DEPLOYMENT_PROJECTS_DIRECTORY with the directory of the projects."
|
||||||
|
res.reply "Temporaly, you can use the command: deploy set directory <directory>"
|
||||||
|
return
|
||||||
|
|
||||||
project = res.match[1]
|
project = res.match[1]
|
||||||
target = res.match[6]
|
target = res.match[6]
|
||||||
program = if res.match[3] then res.match[3] else null
|
program = if res.match[3] then res.match[3] else null
|
||||||
branch = if res.match[5] then res.match[5] else null
|
branch = if res.match[5] then res.match[5] else null
|
||||||
commands = if res.match[8] then cleanCommands res.match[8].split "," else []
|
commands = if res.match[8] then cleanCommands res.match[8].split "," else []
|
||||||
|
|
||||||
directory = "/home/simon/www/repo/" + project
|
if deploymentDirectory != null
|
||||||
|
directory = deploymentDirectory
|
||||||
|
else
|
||||||
|
directory = process.env.HUBO_DEPLOYMENT_PROJECTS_DIRECTORY
|
||||||
|
|
||||||
|
directory += "/" + project
|
||||||
|
|
||||||
try
|
try
|
||||||
fs.stat directory, (err, stats) ->
|
fs.stat directory, (err, stats) ->
|
||||||
|
@ -103,7 +121,6 @@ buildDeployCommand = (directory, program, target) ->
|
||||||
command = interpreter + ' project:deploy ' + target + ' --go'
|
command = interpreter + ' project:deploy ' + target + ' --go'
|
||||||
|
|
||||||
command
|
command
|
||||||
|
|
||||||
|
|
||||||
cleanCommands = (commands) ->
|
cleanCommands = (commands) ->
|
||||||
results = []
|
results = []
|
||||||
|
|
Loading…
Reference in a new issue