Search code examples
hubot

hubot shell not loading scripts and packages


Hubot works when I have an adapter, but when I try to do local development using Shell none of the scripts or packages are loaded.

This works:

  root@dev:~/hubot# bin/hubot forever start -w --watchDirectory ${PWD} --watchIgnore ${PWD}/*.log --pidfile ${PWD}/hubot.pid -l ${PWD}/hubot.log -a -c coffee node_modules/.bin/hubot --adapter slack

Strangely, when I try to do local development and testing with:

 root@dev:~/hubot# bin/hubot
 [Thu Apr 07 2016 00:33:10 GMT+0000 (UTC)] INFO hubot-redis-brain: Using default redis on localhost:6379
 eve>
 eve> help
 usage:
 history
 exit, \q - close shell and exit
 help, \? - print this usage
 clear, \c - clear the terminal screen

None of my scripts or modules are showing when I type help in shell. But when I do this in slack, I see all the available scripts and modules:

 eve <user> doesn't have <role> role - Removes a role from a user
 eve <user> has <role> role - Assigns a role to a user
 eve adapter - Reply with the adapter
 eve delete reminder <action> - Delete reminder matching <action> (exact match required)
 eve deploy <gitsha> to production - Runs Jenkins Phase 1 deployment.
 eve echo <text> - Reply back with <text>
 eve flip production pools - Flips the yin and yang production pools
 eve help - Displays all of the help commands that Hubot knows about.
 eve help <query> - Displays all help commands that match <query>.
 eve list jobs - List current cron jobs
 eve new job "<crontab format>" <message> - Schedule a cron job to say something
 eve new job <crontab format> "<message>" - Ditto
 eve new job <crontab format> say <message> - Ditto
 eve ping - Reply with pong

** Update 1: I turned on debug level logging, and I can see the scripts are being parsed, but the scripts aren't available to me when executing their commands :(**

[Thu Apr 07 2016 00:46:44 GMT+0000 (UTC)] DEBUG Loading adapter shell eve> [Thu Apr 07 2016 00:46:44 GMT+0000 (UTC)] DEBUG Loading scripts from /root/hubot/scripts [Thu Apr 07 2016 00:46:44 GMT+0000 (UTC)] DEBUG Parsing help for /root/hubot/scripts/example.coffee [Thu Apr 07 2016 00:46:44 GMT+0000 (UTC)] DEBUG Parsing help for /root/hubot/scripts/prod_deploy.coffee [Thu Apr 07 2016 00:46:44 GMT+0000 (UTC)] DEBUG Parsing help for /root/hubot/scripts/remindme.coffee [Thu Apr 07 2016 00:46:44 GMT+0000 (UTC)] DEBUG Parsing help for /root/hubot/scripts/team_tools.coffee [Thu Apr 07 2016 00:46:44 GMT+0000 (UTC)] DEBUG Parsing help for /root/hubot/scripts/update.coffee [Thu Apr 07 2016 00:46:44 GMT+0000 (UTC)] DEBUG Loading scripts from /root/hubot/src/scripts [Thu Apr 07 2016 00:46:44 GMT+0000 (UTC)] DEBUG Loading hubot-scripts from /root/hubot/node_modules/hubot-scripts/src/scripts [Thu Apr 07 2016 00:46:44 GMT+0000 (UTC)] DEBUG Loading external-scripts from npm packages [Thu Apr 07 2016 00:46:45 GMT+0000 (UTC)] DEBUG Parsing help for /root/hubot/node_modules/hubot-diagnostics/src/diagnostics.coffee [Thu Apr 07 2016 00:46:45 GMT+0000 (UTC)] INFO hubot-redis-brain: Using default redis on localhost:6379 [Thu Apr 07 2016 00:46:45 GMT+0000 (UTC)] DEBUG Parsing help for /root/hubot/node_modules/hubot-redis-brain/src/redis-brain.coffee [Thu Apr 07 2016 00:46:45 GMT+0000 (UTC)] DEBUG Parsing help for /root/hubot/node_modules/hubot-auth/src/auth.coffee [Thu Apr 07 2016 00:46:45 GMT+0000 (UTC)] DEBUG Parsing help for /root/hubot/node_modules/hubot-help/src/help.coffee [Thu Apr 07 2016 00:46:45 GMT+0000 (UTC)] DEBUG Parsing help for /root/hubot/node_modules/hubot-cron/src/scripts/cron.coffee

Update 2: I realized part of my problem was that in the bin/hubot file explicitly has my bot name as eve, while I have been trying it with evedev, my development hubot name. However, I'm still wondering why the help command does not show all the available commands, but when I'm in Slack, it does.


Solution

  • As answer to your Update 2, you need to put the bot's name before you type help, like this:

    myhubot> help
    usage:
    history
    exit, \q - close shell and exit
    help, \? - print this usage
    clear, \c - clear the terminal screen
    

    vs

    myhubot> myhubot help
    myhubot> Shell: myhubot adapter - Reply with the adapter
    myhubot animate me <query> - The same thing as `image me`, except adds a few parameters to try to return an animated GIF instead.
    myhubot echo <text> - Reply back with <text>
    myhubot help - Displays all of the help commands that Hubot knows about.
    myhubot help <query> - Displays all help commands that match <query>.
    myhubot image me <query> - The Original. Queries Google Images for <query> and returns a random top result.
    myhubot map me <query> - Returns a map view of the area returned by `query`.
    myhubot mustache me <url|query> - Adds a mustache to the specified URL or query result.
    myhubot ping - Reply with pong
    myhubot pug bomb N - get N pugs
    myhubot pug me - Receive a pug
    myhubot the rules - Make sure hubot still knows the rules.
    myhubot time - Reply with current time
    myhubot translate me <phrase> - Searches for a translation for the <phrase> and then prints that bad boy out.
    myhubot translate me from <source> into <target> <phrase> - Translates <phrase> from <source> into <target>. Both <source> and <target> are optional
    ship it - Display a motivation squirrel