This repository has been archived by the owner on Feb 5, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Tim Morgan
committed
Jul 3, 2008
1 parent
c6d61e5
commit d5069e2
Showing
1 changed file
with
63 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ h1. Autumn: A Ruby IRC Bot Framework | |
|
||
| Author | Tim Morgan (mailto:[email protected]) | | ||
| Copyright | Copyright (c)2007-2008 Tim Morgan | | ||
| License | Distributed under the same terms as Ruby. Portions of this code are copyright (c)2004 David Heinemeier Hansson; please see libs/inheritable_attributes.rb for more information. | | ||
| License | Distributed under the same terms as Ruby. Portions of this code are copyright (c)2004 David Heinemeier Hansson; please see <tt>libs/inheritable_attributes.rb</tt> for more information. | | ||
|
||
Autumn is a full-featured framework on top of which IRC bots (called "leaves") | ||
can be quickly and easily built. It features a very Ruby-like approach to | ||
|
@@ -33,53 +33,53 @@ a bit I will explain in detail what all of this stuff is. For now, here is an | |
overview you can consult for future reference: | ||
|
||
* *config/* - Configuration files and | ||
* global.yml - Universal settings that apply to every season | ||
* *seasons/* - Contains directories for each season (see *Seasons*) | ||
* *testing/* - Example season | ||
* database.yml - Example database configuration file | ||
* leaves.yml - Example bot configuration file | ||
* season.yml - Season configuration | ||
* stems.yml - Example IRC configuration file | ||
** global.yml - Universal settings that apply to every season | ||
** *seasons/* - Contains directories for each season (see *Seasons*) | ||
*** *testing/* - Example season | ||
**** database.yml - Example database configuration file | ||
**** leaves.yml - Example bot configuration file | ||
**** season.yml - Season configuration | ||
**** stems.yml - Example IRC configuration file | ||
* *data/* - Not used by the program, but you can store your SQLite database | ||
files here. | ||
* *doc/* - HTML documentation generated by RDoc | ||
* *api/* - Autumn API documentation | ||
* *leaves/* - Autumn leaves documentation | ||
** *api/* - Autumn API documentation | ||
** *leaves/* - Autumn leaves documentation | ||
* *leaves/* - @Autumn::Leaf@ subclasses | ||
* scorekeeper.rb - Example leaf provided with the installation | ||
** scorekeeper.rb - Example leaf provided with the installation | ||
* *libs/* - Autumn core code | ||
* channel_leaf.rb - A leaf subclass that can ignore messages from certain | ||
channels its in | ||
* coder.rb - Used by <tt>script/generate</tt> to write out Ruby code | ||
* ctcp.rb - CTCP support library | ||
* daemon.rb - Provides support for different kinds of IRC servers | ||
* foliater.rb - Instantiates and manages stems and leaves | ||
* formatting.rb - Provides support for different kinds of IRC client text | ||
formatting and colorization | ||
* generator.rb - Library used by <tt>script/generate</tt> | ||
* genesis.rb - Boots the Autumn environment | ||
* inheritable_attributes.rb - Adds support for class-level inheritable | ||
attributes | ||
* leaf.rb - The core bot superclass | ||
* log_facade.rb - Simplifies logging for stems and leaves | ||
* misc.rb - RubyCore class additions and other knick-knacks | ||
* script.rb - Library used by <tt>script/generate</tt> and | ||
<tt>script/destroy</tt> | ||
* speciator.rb - Manages global, season, stem, and leaf configurations | ||
* stem.rb - IRC client library | ||
* stem_facade.rb - Additional methods to simplify the @Autumn::Stem@ class | ||
** channel_leaf.rb - A leaf subclass that can ignore messages from certain | ||
channels its in | ||
** coder.rb - Used by <tt>script/generate</tt> to write out Ruby code | ||
** ctcp.rb - CTCP support library | ||
** daemon.rb - Provides support for different kinds of IRC servers | ||
** foliater.rb - Instantiates and manages stems and leaves | ||
** formatting.rb - Provides support for different kinds of IRC client text | ||
formatting and colorization | ||
** generator.rb - Library used by <tt>script/generate</tt> | ||
** genesis.rb - Boots the Autumn environment | ||
** inheritable_attributes.rb - Adds support for class-level inheritable | ||
attributes | ||
** leaf.rb - The core bot superclass | ||
** log_facade.rb - Simplifies logging for stems and leaves | ||
** misc.rb - RubyCore class additions and other knick-knacks | ||
** script.rb - Library used by <tt>script/generate</tt> and | ||
<tt>script/destroy</tt> | ||
** speciator.rb - Manages global, season, stem, and leaf configurations | ||
** stem.rb - IRC client library | ||
** stem_facade.rb - Additional methods to simplify the @Autumn::Stem@ class | ||
* *log/* - Directory where (most) Autumn logs are written (see the *Logs* | ||
section) | ||
* Rakefile - Contains the rake tasks used to control Autumn (see the *Tasks* | ||
section) | ||
* README - This file | ||
* *resources/* - Data files used by Autumn | ||
* *daemons/* - Data files describing different IRC server types | ||
** *daemons/* - Data files describing different IRC server types | ||
* *script/* - Helper scripts for controlling Autumn | ||
* daemon - Runs Autumn as a daemon | ||
* destroy - Destroys Autumn objects | ||
* generate - Creates Autumn objects | ||
* server - Starts Autumn | ||
** daemon - Runs Autumn as a daemon | ||
** destroy - Destroys Autumn objects | ||
** generate - Creates Autumn objects | ||
** server - Starts Autumn | ||
* *support/* - Additional code your bots need | ||
* *tmp/* - Temporary files, such as PID files | ||
|
||
|
@@ -273,7 +273,7 @@ In addition, the following options are available (but cannot be set in the yml | |
file): | ||
|
||
| @root@ | The root directory of the Autumn installation. | | ||
| @system_logger@ | The Autumn::LogFacade instance that records system messages. | | ||
| @system_logger@ | The @Autumn::LogFacade@ instance that records system messages. | | ||
|
||
h4. Season | ||
|
||
|
@@ -294,7 +294,7 @@ are: | |
|
||
| @server@ | The address of the IRC server. | | ||
| @port@ | The IRC server port (default 6667). | | ||
| @ip_address | The IP address to connect on (for virtual hosting). | | ||
| @ip_address@ | The IP address to connect on (for virtual hosting). | | ||
| @nick@ | The nick to request. | | ||
| @password@ | The nick's password, if it is registered. | | ||
| @channel@ | A channel to join. | | ||
|
@@ -343,7 +343,7 @@ The standard options are: | |
| @command_prefix@ | The text that must precede each command. Defaults to "!". | | ||
| @respond_to_private_messages@ | If true, the leaf will parse commands in whispers, and respond over whispers to those commands. | | ||
| @database@ | A database connection to use (as defined in <tt>database.yml</tt>). By default Autumn will choose a connection named after your leaf. | | ||
| @formatter@ | The name of a module in Autumn::Formatting that will handle output formatting and colorization. This defaults to mIRC-style formatting. | | ||
| @formatter@ | The name of a module in @Autumn::Formatting@ that will handle output formatting and colorization. This defaults to mIRC-style formatting. | | ||
|
||
h3. Custom Configuration Options | ||
|
||
|
@@ -429,10 +429,10 @@ to other classes; this is not a requirement of the filter framework, though. | |
Now let's say you wanted to prevent the command from being run in some cases. | ||
The most obvious application of this feature is authentication: You don't want | ||
just any person to run your leaf's administrative commands. So, you write a | ||
@before_filter@ to determine if the user is authenticated. @before_filter@s have | ||
return values; if they return false, the filter chain is halted and the command | ||
is suppressed. If you want to have your leaf display some sort of message (like | ||
"Nice try!"), you need to include that in your filter. | ||
@before_filter@ to determine if the user is authenticated. @before_filter@ | ||
methods have return values; if they return false, the filter chain is halted and | ||
the command is suppressed. If you want to have your leaf display some sort of | ||
message (like "Nice try!"), you need to include that in your filter. | ||
|
||
As an example, here's a simple form of authentication that just checks a | ||
person's nick: | ||
|
@@ -461,14 +461,14 @@ I'm introducing you to three new features with this sample: | |
Both of these examples use the parameters sent to your filter method. They are, | ||
in order: | ||
|
||
#. the @Autumn::Stem@ instance that received the command, | ||
#. the name of the channel to which the command was sent (or @nil@ if it was a | ||
private message), | ||
#. the sender hash, | ||
#. the name of the command that was typed, as a symbol, | ||
#. any additional parameters after the command (same as the @msg@ parameter in | ||
the <tt>*_command</tt> methods), | ||
#. the custom options that were given to @before_filter@ or @after_filter@. | ||
# the @Autumn::Stem@ instance that received the command, | ||
# the name of the channel to which the command was sent (or @nil@ if it was a | ||
private message), | ||
# the sender hash, | ||
# the name of the command that was typed, as a symbol, | ||
# any additional parameters after the command (same as the @msg@ parameter in | ||
the <tt>[word]_command</tt> methods), | ||
# the custom options that were given to @before_filter@ or @after_filter@. | ||
|
||
There are two built-in options that you can specify for @before_filter@ and | ||
@after_filter@, and those are @only@ and @except@. They work just like in Rails: | ||
|
@@ -535,11 +535,11 @@ invoked methods (such as @did_receive_private_message@), the database connection | |
will already be set for you, and you can start using your DataMapper objects | ||
just like ActiveRecord objects. | ||
|
||
If, on the other hand, you either *named your database connection differently from your leaf or subclass name* | ||
or you are *writing a method outside of the normal flow of leaf methods* (for | ||
instance, one that is directly called by a @Stem@, or a different listener), you | ||
will need to call the @database@ method and pass it a block containing your | ||
code. | ||
If, on the other hand, you either *named your database connection differently | ||
from your leaf or subclass name* or you are *writing a method outside of the | ||
normal flow of leaf methods* (for instance, one that is directly called by a | ||
@Stem@, or a different listener), you will need to call the @database@ method | ||
and pass it a block containing your code. | ||
|
||
This is terribly confusing, so let me give you an example. Let's assume you've | ||
got a fortune bot running off of a @FortuneLeaf@ subclass, so your leaf | ||
|
@@ -757,8 +757,8 @@ if you don't specify any channels, simplifying our code to: | |
|
||
<code>stems.each { |stem| stem.message "Hello!" }</code> | ||
|
||
It gets even better. *You can call methods on the @stems@ array as if it were a stem itself!* | ||
This simplifies the line significantly: | ||
It gets even better. *You can call methods on the @stems@ array as if it were a | ||
stem itself!* This simplifies the line significantly: | ||
|
||
<code>stems.message "Hello!"</code> | ||
|
||
|
@@ -998,11 +998,11 @@ h2. Getting Ready for Deployment | |
There's only a few things you need to do once your leaf is ready to greet | ||
the Real World: | ||
|
||
1. Create a new production season. Configure your stems, leaves, and database | ||
as necessary for your production environment. | ||
2. In <tt>config/global.yml</tt>, set the season to your production season. | ||
3. If desired, in <tt>script/daemon</tt>, set the @:monitor@ option to true. | ||
This will spawn a monitor process that will relaunch Autumn if it crashes. | ||
# Create a new production season. Configure your stems, leaves, and database | ||
as necessary for your production environment. | ||
# In <tt>config/global.yml</tt>, set the season to your production season. | ||
# If desired, in <tt>script/daemon</tt>, set the @:monitor@ option to true. | ||
This will spawn a monitor process that will relaunch Autumn if it crashes. | ||
|
||
h2. Other Information | ||
|
||
|