Skip to content

Instantly share code, notes, and snippets.

@jefftriplett
Last active January 2, 2016 00:59
Show Gist options
  • Save jefftriplett/8227394 to your computer and use it in GitHub Desktop.
Save jefftriplett/8227394 to your computer and use it in GitHub Desktop.
A really basic hubot fabric wrapper. Works for me but this is just the basics. Set an environment variable for `HUBOT_FABRIC_PATH` and try `fab help` or `fabric help` to get a list of commands.
# fab <command> - to manage fabric
{spawn, exec} = require 'child_process'
fabric_path = process.env.HUBOT_FABRIC_PATH
fabric_bin = "cd " + fabric_path + " && fab "
module.exports = (robot) ->
robot.respond /(fab|fabric) ?([\w .-]+)/i, (msg) ->
if msg.match[2] != undefined
if msg.match[2] == "help"
exec fabric_bin + " --list", (err, stdout, stderr) ->
if err
msg.send "ERROR: " + err
else
msg.send stdout
else
exec fabric_bin + msg.match[2], (err, stdout, stderr) ->
msg.send stdout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment