Last active
December 27, 2015 14:39
-
-
Save rafael/7342453 to your computer and use it in GitHub Desktop.
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
| # Description: | |
| # Utility commands to enable/disable and show status of continuous deployment. | |
| # | |
| # Commands: | |
| # hubot continuous deployment disable - Disables continuous deployment | |
| # hubot continuous deployment enable - Enables continuous deployment | |
| # hubot continuous deployment status- Displays the status of continuous deployment | |
| util = require 'util' | |
| querystring = require('querystring'); | |
| module.exports = (robot) -> | |
| robot.respond /continuous deployment disable$/i, (msg) -> | |
| robot.brain.set('continuous_deployment', false) | |
| updateCIRoomTopic "Continuous Deployment: Disabled" | |
| msg.send "Continuous deployment disabled" | |
| robot.respond /continuous deployment enable/i, (msg) -> | |
| robot.brain.set('continuous_deployment', true) | |
| updateCIRoomTopic "Continuous Deployment: Enabled" | |
| msg.send "Continuous deployment enabled" | |
| robot.respond /continuous deployment status/i, (msg) -> | |
| if (robot.brain.get('continuous_deployment') == true) | |
| msg.send "Continuous deployment is enabled" | |
| else | |
| msg.send "Continuous deployment is disabled" | |
| updateCIRoomTopic = (topic) -> | |
| util.puts(topic) | |
| post_data = querystring.stringify({ 'room_id': 00000, 'topic': topic, 'from': '@yourobot' }) | |
| robot.adapter.post('/v1/rooms/topic', post_data, postCallback) | |
| postCallback = (error, response) -> | |
| util.puts(error) | |
| util.puts(util.inspect(response)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment