Every repository with this icon (
Every repository with this icon (
tree 9af36e10e49b6d68b6e0685c1857350b31635a09
parent 1ae8d1cb4e5cf1a9265fff52333e18d373e831e1
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Sun Oct 05 05:16:38 -0700 2008 | |
| |
README.textile | Wed Sep 09 11:15:39 -0700 2009 | |
| |
Rakefile | ||
| |
VERSION.yml | ||
| |
bin/ | ||
| |
config/ | ||
| |
handlers/ | ||
| |
lib/ | ||
| |
log/ | Fri Jul 25 18:02:12 -0700 2008 | |
| |
marvin.gemspec | ||
| |
rfcs/ | Sat Nov 22 03:22:31 -0800 2008 | |
| |
script/ | ||
| |
spec/ | Mon Sep 15 11:16:39 -0700 2008 | |
| |
test/ | ||
| |
tmp/ | Fri Jul 25 18:02:12 -0700 2008 |
Marvin
Marvin is a ruby irc framework / library built on top of event machine.
It’s been build from scratch to be evented – you build “handlers” which
are called whenever an event occurs.
A single client instance can handle multiple IRC connections (and will
automatically reconnect in the case that a connection is lost). Distributed
support (e.g. 1 client => multiple handler backends) is built in out of
the box on top of DRb.
Getting Started
Starting out with Marvin is simple. You can either go the “edge” route -
cloning from the GitHub repository (in this case, [here](http://github.com/sutto/marvin))
and then running the following:
Or, for a generally more stable release you can install it from the GitHub gem
server (requiring Rubygems >= 1.2.0 with the GitHub sources added), by running
the following:
Installing the gem will make available a new executable – “marvin” – which is
used as an easy way to do a variety of tasks. To get started, you can create
a project located at given path using the following command:
Once that’s done, you’ll have a blank slate loaded with the default marvin handlers -
HelloWorld (which will respond to any addressed "hello"’s) and an empty debug handler
which you can use for generic debugging. To run the new app, you can use either of the
following:
or, alternatively,
$ marvin client path-to-my-botThere are a couple of options available for the client (as well as the marvin library),
Each of which can be found by appending the “—help” option to the command.
Once your client has been started (assuming the name wasn’t taken / it could connect),
simply join the chat room your bot was instructed to join and say the following (substiting
BotNick for the nick name your bot connected with):
Or even easier, by PM’ing the bot with:
helloAssuming all went well, your bot should reply back with something akin to (where YourNick)
if the nickname you connected with):
Distributed Bots
One of the relatively unique features of Marvin is the ability to write bots
which use DRb and Rinda which can grow with relative ease.
It’s important to keep in mind that keeping state is discouraged in this case
as it can not be ensured that clients are still active or that you will always
get messages from the same client.
For a start, take a look at the default config/setup.rb file which contains
an example of registering handlers on a distributed client as well as setting
up the distributed handler which needs to be setup on the main client.
By default, the messages will be dispatched to the first discovered tuple
space (using Rinda::RingFinger) and will be of the format:
You can change the namespace (which defaults to :default) by setting Marvin::Settings.distributed_namespace
Running a distributed client requires three things:
- 1 Ring server instance (script/ring_server or marvin ring_server or marvin rs)
- 1+ Client instances (script/client or marvin client or marvin cl)
- 1+ Distributed Client instances (script/distributed_client or marvin distributed_client or marvin dc)
Each of which takes the default options of:
- -v – Be verbose and print to STDOUT if not daemonized
- -level=something – set level, defaults to info
- -d – daemonize the process
- -k – kill all daemonized instances of this specific kind
Example Bots
Coming soon.
Thanks
Thanks go to:
- Jeff Rafter – contributed code and doc changes, now one of the co-developers.
- epitron / halogrium – For the ragel state machine used in Marvin::Parsers::RagelParser
- The creator of Ruby-IRCD – the server component is heavily influenced by / part derivative of said work.








