Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
The RubyIreland Hubot for the #ruby.ie IRC channel
CoffeeScript Shell
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
bin
scripts
.gitignore
Procfile
README.md
hubot-scripts.json
package.json

README.md

The ruby-ie hubot

This is the RubyIreland Hubot, which prowls the #ruby.ie IRC channel as the user ruby-ie. You can get a full list of commands by going into the Ruby IRC channel at #ruby.ie on irc.freenode.net and running ruby-ie help Please note that the output of the help command will appear for all users on the #ruby-ie channel as will the output of any commands - think of it as something collaborative! That's okay, just don't go crazy on the help command (eg. run it once and copy and paste the output into a text file for future reference). The other commands are less verbose in terms of output - and lots more fun!

Hacking on the ruby-ie hubot

It's easy to add interesting new things to the RubyIreland hubot. You'll need to install node locally (see below) to get things going. Then just comment out the redis dependency (redis-brain.coffee) from hubot-scripts and run bin/hubot to get a local hubot shell into which you can run commands - just like you are on the IRC channel! Extending the ruby-ie hubot's range of commands is done through coffeescript files under the scripts directory. Give it a go, then submit a pull request or let us know by posting on https://groups.google.com/forum/?fromgroups#!forum/ruby_ireland

The existing Hubot README file contents have been preserved below to help you get set up. Take the time to read it and you'll be cranking out sickingly cool ruby-ie hubot extensions in no time.

Hubot

This is a version of GitHub's Campfire bot, hubot. He's pretty cool.

This version is designed to be deployed on Heroku.

Playing with Hubot

You'll need to install the necessary dependencies for hubot. All of those dependencies are provided by npm.

HTTP Listener

Hubot has a HTTP listener which listens on the port specified by the PORT environment variable.

You can specify routes to listen on in your scripts by using the router property on robot.

module.exports = (robot) ->
  robot.router.get "/hubot/version", (req, res) ->
    res.end robot.version

There are functions for GET, POST, PUT and DELETE, which all take a route and callback function that accepts a request and a response.

Redis

If you are going to use the redis-brain.coffee script from hubot-scripts you will need to add the Redis to Go addon on Heroku which requires a verified account or you can create an account at Redis to Go and manually set the REDISTOGO_URL variable.

% heroku config:add REDISTOGO_URL="..."

If you don't require any persistence feel free to remove the redis-brain.coffee from hubot-scripts.json and you don't need to worry about redis at all.

Testing Hubot Locally

You can test your hubot by running the following.

% bin/hubot

You'll see some start up output about where your scripts come from and a prompt.

[Sun, 04 Dec 2011 18:41:11 GMT] INFO Loading adapter shell
[Sun, 04 Dec 2011 18:41:11 GMT] INFO Loading scripts from /home/tomb/Development/hubot/scripts
[Sun, 04 Dec 2011 18:41:11 GMT] INFO Loading scripts from /home/tomb/Development/hubot/src/scripts
Hubot>

Then you can interact with hubot by typing hubot help.

Hubot> hubot help

Hubot> animate me <query> - The same thing as `image me`, except adds a few
convert me <expression> to <units> - Convert expression to given units.
help - Displays all of the help commands that Hubot knows about.
...

Take a look at the scripts in the ./scripts folder for examples. Delete any scripts you think are silly. Add whatever functionality you want hubot to have.

Adapters

Adapters are the interface to the service you want your hubot to run on. This can be something like Campfire or IRC. There are a number of third party adapters that the community have contributed. Check the hubot wiki for the available ones.

If you would like to run a non-Campfire or shell adapter you will need to add the adapter package as a dependency to the package.json file in the dependencies section.

Once you've added the dependency and run npm install to install it you can then run hubot with the adapter.

% bin/hubot -a <adapter>

Where <adapter> is the name of your adapter without the hubot- prefix.

hubot-scripts

There will inevitably be functionality that everyone will want. Instead of adding it to hubot itself, you can submit pull requests to hubot-scripts.

To enable scripts from the hubot-scripts package, add the script name with extension as a double quoted string to the hubot-scripts.json file in this repo.

Deployment

% heroku create --stack cedar
% git push heroku master
% heroku ps:scale app=1

If your Heroku account has been verified you can run the following to enable and add the Redis to Go addon to your app.

% heroku addons:add redistogo:nano

If you run into any problems, checkout Heroku's docs.

You'll need to edit the Procfile to set the name of your hubot.

More detailed documentation can be found on the deploying hubot onto Heroku wiki page.

Deploying to UNIX or Windows

If you would like to deploy to either a UNIX operating system or Windows. Please check out the deploying hubot onto UNIX and deploying hubot onto Windows wiki pages.

Campfire Variables

If you are using the Campfire adapter you will need to set some environment variables. Refer to the documentation for other adapters and the configuraiton of those, links to the adapters can be found on the hubot wiki.

Create a separate Campfire user for your bot and get their token from the web UI.

% heroku config:add HUBOT_CAMPFIRE_TOKEN="..."

Get the numeric IDs of the rooms you want the bot to join, comma delimited. If you want the bot to connect to https://mysubdomain.campfirenow.com/room/42 and https://mysubdomain.campfirenow.com/room/1024 then you'd add it like this:

% heroku config:add HUBOT_CAMPFIRE_ROOMS="42,1024"

Add the subdomain hubot should connect to. If you web URL looks like http://mysubdomain.campfirenow.com then you'd add it like this:

% heroku config:add HUBOT_CAMPFIRE_ACCOUNT="mysubdomain"

Restart the bot

You may want to get comfortable with heroku logs and heroku restart if you're having issues.

Something went wrong with that request. Please try again.