SBaronda.com a little place I like to call home.


Getting Hubot Working With Newer Version of CoffeeScript

Feb. 23, 2015

At my employers we recently switched from using Google Hangouts to using Slack. We like the power it gives us with the ability to extensionize it. So for the first extension, I've decided that it would be nice to keep everyone in the loop with recent commit messages. One way of interacting with Slack are through awesome tools like Hubot, which got introduced by Github back in 2011.

I decided to build out a new plugin for Hubot that would get information about our repos, but not using a OAuth since we have a dedicated user that we use for Github related items. When building out I wanted to use some new CoffeeScript features that weren't in the version of CoffeeScript that Hubot packaged.

I didn't know about this incompatibility until after I developed out the plugin, silly me, I should have been testing inside of Hubot. After investigating, I saw that Hubot was using a very old version of CoffeeScript, version 1.6.3, which was dated Jun 2, 2013. Obviously this is quite an old version.

I then decided I would try to update Hubot to a newer version. After doing so and submitting a pull request, I later found out that this wasn't needed.

technicalpickles, found a solution to the problem by looking at how ./bin/hubot handles the PATH variable.

The solutions is quite simple, just npm install --save-dev coffee-script inside of your bot directory. When Hubot runs it will pick up that path first before it uses the Hubot versioned coffee-script.

Now your package.json file should look like this:

{
  "name": "hubot",
  "version": "0.0.0",
  "private": true,
  "author": "silasb <silas.baronda@gmail.com>",
  "description": "A simple helpful robot for your Company",
  "dependencies": {
    "hubot": "^2.11.0",
    "hubot-diagnostics": "0.0.1",
    "hubot-github-create-issues": "0.0.5",
    "hubot-google-images": "^0.1.2",
    "hubot-google-translate": "^0.1.0",
    "hubot-help": "^0.1.1",
    "hubot-heroku-keepalive": "0.0.4",
    "hubot-maps": "0.0.1",
    "hubot-pugme": "^0.1.0",
    "hubot-redis-brain": "0.0.2",
    "hubot-rules": "^0.1.0",
    "hubot-scripts": "^2.5.16",
    "hubot-shipit": "^0.1.1",
    "hubot-slack": "^3.2.1",
    "hubot-youtube": "^0.1.2"
  },
  "engines": {
    "node": "0.10.x"
  },
  "devDependencies": {
    "coffee-script": "^1.9.1"
  }
}


comments powered by Disqus