Skip to content

Instantly share code, notes, and snippets.

@dannymcc
Created October 30, 2011 10:49
Show Gist options
  • Save dannymcc/1325777 to your computer and use it in GitHub Desktop.
Save dannymcc/1325777 to your computer and use it in GitHub Desktop.
Deploy your application with hubot and deploy docus
# Allows Hubot to deploy, using Deploy Docus
#
# deploy <project> on <environment>
#
module.exports = (robot) ->
robot.respond /deploy (.*) (on|to|into) (.*)/, (msg) ->
if msg.message.user.type == "Member"
project = msg.match[1]
environment = msg.match[3]
deploy_domain = process.env.HUBOT_DEPLOYDOCUS_DOMAIN
deploy_token = process.env.HUBOT_DEPLOYDOCUS_TOKEN
msg.send "Deploying #{project} into #{environment}"
msg.http("http://#{deploy_domain}/#{project}/#{environment}")
.query({
token: deploy_token
})
.post() (err, res, body) =>
if err
msg.send "An error occured: #{err} - The deployment has probably occured anyway"
return
data = JSON.parse(body)
msg.send "#{project} deployed into #{environment} : #{data['status']}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment