Skip to content

Instantly share code, notes, and snippets.

@technicalpickles
Last active November 8, 2020 20:59
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save technicalpickles/5941963c502dc43d9d07 to your computer and use it in GitHub Desktop.
Save technicalpickles/5941963c502dc43d9d07 to your computer and use it in GitHub Desktop.
hubot with debugging
#!/bin/bash
set -e
for opt in $* ; do
case "$opt" in
--debug) hubot_debug="coffee --nodejs --debug";;
esac
done
if [ -n "$hubot_debug" -a "$NODE_ENV" != "development" ] ; then
unset hubot_debug
fi
exec ${hubot_debug} node_modules/.bin/hubot "$@"

Debugging Hubot

Javascript and coffeescript can be hard, and writing hubot scripts even harder. If you are stumped with what hubot is actually doing, you can use node-inspector to poke around.

To get started:

The debugger starts you in node_modules/hubot/bin/hubot, but you can broese up to the hubot root directory, and then into scripts to get at the our scripts.

Unfortunately, the contents of scripts in node-inspector seems to be the compiled javascript, rather than coffeescript, but it is better than nothing.

#!/bin/sh
node-inspector --web-port=8081
@SeanFromIT
Copy link

bin/hubot --debug no longer works in latest version. They seem to have changed a lot of stuff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment