Created
October 30, 2011 10:49
-
-
Save dannymcc/1325777 to your computer and use it in GitHub Desktop.
Deploy your application with hubot and deploy docus
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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