code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
require 'data_mapper'
# Install the "chronic" gem for more robust date parsing
begin
gem 'chronic'
require 'chronic'
rescue Gem::LoadError
end
# An Autumn Leaf used for an in-channel scorekeeping system. This can operate
# both as an open or closed score system. (In the former, new members are
# automatically adde... | Ruby |
# An IRC server and channel. The server property is of the form
# "[address]:[port]".
class Channel < DataMapper::Base
property :server, :string, :nullable => false
property :name, :string, :nullable => false
has_many :scores
end
| Ruby |
# A person's nickname. If someone changes a person's points using this nickname,
# the correct Person instance has their points changed.
class Pseudonym < DataMapper::Base
property :name, :string, :nullable => false
belongs_to :person
end
| Ruby |
require 'facets/conversion'
# Utility methods used by Scorekeeper.
module ScorekeeperHelper
def parse_date(str)
date = nil
begin
date = Chronic.parse(str, :context => :past, :guess => false)
rescue NameError
begin
date = Date.parse(str)
rescue ArgumentError
end
end
... | Ruby |
# A change to a person's score.
class Score < DataMapper::Base
property :change, :integer, :nullable => false, :default => 0
property :note, :string
property :created_at, :datetime
belongs_to :giver, :class => 'Person'
belongs_to :receiver, :class => 'Person'
belongs_to :channel
end
| Ruby |
# An IRC member who can give or receive points.
class Person < DataMapper::Base
property :server, :string, :nullable => false
property :name, :string, :nullable => false
property :authorized, :boolean, :nullable => false, :default => true
has_many :scores, :class => 'Score', :foreign_key => 'receiver_id'
... | Ruby |
require 'rake'
require 'facets/symbol/to_proc'
require 'facets/stylize'
require 'libs/genesis'
task :default do
puts 'Type "rake --tasks" to see a list of tasks you can perform.'
end
# Load the Autumn environment.
task :environment do
AL_ROOT = File.dirname(__FILE__)
@genesis = Autumn::Genesis.new
@genesis.lo... | Ruby |
#!/usr/bin/env ruby
#
# == Synopsis
#
# Destroys the files for leaves, seasons, and other objects of the Autumn
# framework.
#
# == Usage
#
# script/destroy <options> <object> <name>
#
# <object>:: The object type to destroy. Valid types are "leaf" and "season".
# <name>:: The name of the object to destroy. For example... | Ruby |
#!/usr/bin/env ruby
#
# Controller for the Autumn daemon. Starts, stops, and manages the daemon. Must
# be run from the Autumn root directory.
#
# Usage: script/daemon <command> <options> -- <application options>
#
# * where <command> is one of:
# start start an instance of the application
# stop ... | Ruby |
#!/usr/bin/env ruby
#
# Runs Autumn from the command line. This script will not exit until all leaves
# have exited. To use this script as a daemon, see the script/daemon script.
AL_ROOT = File.expand_path("#{File.dirname(__FILE__)}/..")
Dir.chdir AL_ROOT
require 'libs/genesis'
Autumn::Genesis.new.boot!
| Ruby |
#!/usr/bin/env ruby
#
# == Synopsis
#
# Generates template files for leaves, seasons, and other Autumn objects.
#
# == Usage
#
# script/generate <options> <template> <name>
#
# <template>:: The template to create. Valid templates are "leaf" and "season".
# <name>:: The name to give the created template. For example, yo... | Ruby |
#!/usr/bin/env ruby
#
# == Synopsis
#
# Destroys the files for leaves, seasons, and other objects of the Autumn
# framework.
#
# == Usage
#
# script/destroy <options> <object> <name>
#
# <object>:: The object type to destroy. Valid types are "leaf" and "season".
# <name>:: The name of the object to destroy. For example... | Ruby |
#!/usr/bin/env ruby
#
# == Synopsis
#
# Generates template files for leaves, seasons, and other Autumn objects.
#
# == Usage
#
# script/generate <options> <template> <name>
#
# <template>:: The template to create. Valid templates are "leaf" and "season".
# <name>:: The name to give the created template. For example, yo... | Ruby |
#!/usr/bin/env ruby
#
# Runs Autumn from the command line. This script will not exit until all leaves
# have exited. To use this script as a daemon, see the script/daemon script.
AL_ROOT = File.expand_path("#{File.dirname(__FILE__)}/..")
Dir.chdir AL_ROOT
require 'libs/genesis'
Autumn::Genesis.new.boot!
| Ruby |
#!/usr/bin/env ruby
#
# Controller for the Autumn daemon. Starts, stops, and manages the daemon. Must
# be run from the Autumn root directory.
#
# Usage: script/daemon <command> <options> -- <application options>
#
# * where <command> is one of:
# start start an instance of the application
# stop ... | Ruby |
require 'singleton'
require 'facets/hash/rekey'
require 'facets/hash/autonew'
require 'facets/symbol/to_proc'
module Autumn
# The Speciator stores the global, season, stem, and leaf configurations. It
# generates composite hashes, so that any leaf or stem can know its specific
# configuration as a combination o... | Ruby |
module Autumn
# A collection of convenience methods that are added to the Stem class. These
# methods serve two purposes; one, to allow easier backwards compatibility
# with Autumn Leaves 1.0 (which had a simpler one-stem-per-leaf approach), and
# two, to make it easier or more Ruby-like to perform certain I... | Ruby |
# Miscellaneous extra methods and objects used by Autumn.
require 'thread'
require 'facets/string/case'
require 'facets/stylize'
module Kernel # :nodoc:
# Bugfix for the Facets implementation of +respond+.
def respond(sym, *args)
return nil if not respond_to?(sym)
send(sym, *args)
end
end
class N... | Ruby |
require 'facets/array/only'
require 'facets/symbol/to_proc'
module Autumn # :nodoc:
# Helper class that generates shell Ruby code. This class knows how to
# generate Ruby code for template classes and methods.
class Coder # :nodoc:
# The generated code string.
attr :output
# Creates a new ... | Ruby |
require 'yaml'
require 'singleton'
require 'facets/stylize'
module Autumn
# Loads Stems and Leaves and executes them in their own threads. Manages the
# threads and oversees all leaves. This is a singleton class.
class Foliater
include Singleton
# The Speciator singleton.
attr_reader :config
... | Ruby |
require 'facets/string/partitions'
require 'facets/array/only'
module Autumn
# Describes an IRC server daemon program. Different IRC servers run off of
# different IRC daemons, each of which has a slightly different implementation
# of the IRC protocol. To encapsulate this, the Daemon class stores the names
... | Ruby |
require 'time'
module Autumn
# A listener for a Stem that listens for and handles CTCP requests. You can
# add CTCP support for your IRC client by instantiating this object and
# passing it to the Stem#add_listener method.
#
# CTCP stands for Client-to-Client Protocol and is a way that IRC clients and
# s... | Ruby |
require 'getoptlong'
require 'rdoc/usage'
require 'libs/generator'
module Autumn # :nodoc:
# Manages data used by the script/generate and script/destroy scripts. This
# class is instantiated by the script, and manages the script's data and
# encapsulates common functionality between the two scripts. The objec... | Ruby |
module Autumn
# A special kind of leaf that only responds to messages sent to certain
# channels. Leaves that subclass ChannelLeaf can, in their leaves.yml config,
# specify a +channels+ option that narrows down which channels the leaf
# listens to. The leaf will not invoke the hook methods nor the
# <tt>*... | Ruby |
require 'socket'
require 'openssl'
require 'facets/array/only'
require 'facets/symbol/to_proc'
require 'facets/enumerable/mash'
#require 'facets/kernel/respond'
require 'facets/string/indexable'
require 'facets/string/partitions'
module Autumn
# A connection to an IRC server. The stem acts as the IRC client on wh... | Ruby |
require 'yaml'
require 'facets/stylize'
require 'libs/misc'
require 'libs/coder'
module Autumn # :nodoc:
# Generates the files for Autumn templates such as leaves and seasons. The
# contents of these template files are populated by an LeafCoder instance.
class Generator # :nodoc:
# The names of the req... | Ruby |
require 'facets/array/only'
module Autumn
# This class is a facade for Ruby's +Logger+ that adds additional information
# to log entries. LogFacade will pass any method calls onto a Logger instance,
# but reformat log entries to include an Autumn object's type and name.
#
# For example, if you wanted a Lo... | Ruby |
require 'rubygems'
require 'yaml'
require 'logger'
require 'libs/misc'
require 'libs/speciator'
module Autumn # :nodoc:
# Oversight class responsible for initializing the Autumn environment. To boot
# the Autumn environment start all configured leaves, you make an instance of
# this class and run the boot! me... | Ruby |
require 'yaml'
require 'timeout'
require 'facets/string/partitions'
require 'facets/array/only'
require 'facets/stylize'
require 'libs/formatting'
module Autumn
# This is the superclass that all Autumn leaves use. To write a leaf, sublcass
# this class and implement methods for each of your leaf's commands. You... | Ruby |
# This source file, originating from Ruby on Rails, extends the +Class+ class to
# allows attributes to be shared within an inheritance hierarchy, but where each
# descendant gets a copy of their parents' attributes, instead of just a pointer
# to the same. This means that the child can add elements to, for example, an... | Ruby |
module Autumn
# Adds text formatting to Autumn objects. Text formatting (color and styles)
# is not a part of the original IRC spec, so many clients have come up with
# many different ways of sending formatted text. The classes in this module
# encapsulate those various methods.
#
# To add formatting to ... | Ruby |
require 'data_mapper'
# Install the "chronic" gem for more robust date parsing
begin
gem 'chronic'
require 'chronic'
rescue Gem::LoadError
end
# An Autumn Leaf used for an in-channel scorekeeping system. This can operate
# both as an open or closed score system. (In the former, new members are
# automatically adde... | Ruby |
#!/usr/bin/ruby
#
# Controller for the Autumn Leaves daemon. Starts, stops, and manages the
# daemon.
#
# Usage: big-switch.rb <command> <options> -- <application options>
#
# * where <command> is one of:
# start start an instance of the application
# stop stop all instances of the applicati... | Ruby |
#!/usr/bin/ruby
#
# Controller for the Autumn Leaves daemon. Starts, stops, and manages the
# daemon.
#
# Usage: big-switch.rb <command> <options> -- <application options>
#
# * where <command> is one of:
# start start an instance of the application
# stop stop all instances of the applicati... | Ruby |
# Loads configuration files, loads leaves and support files, then starts the
# Foliater.
require 'yaml'
# Add each_char method to String.
class String # :nodoc:
# Yields each character of the string as an Integer in succession.
def each_char
(0..(length-1)).each { |index| yield self[index] }
end
end
# Load... | Ruby |
true # placed here to prevent the class doc from becoming the file doc
# The Observant Squirrel is the logging class for leaves to use. This logger
# works very similarly to the Ruby on Rails logger. The logger uses five
# severity levels, +debug+, +info+, +warn+, and +error+ (in order). It will only
# log messages wh... | Ruby |
require 'yaml'
require 'singleton'
# Loads leaves and executes them in their own threads. Manages the threads and
# oversees all leaves. This is a singleton class, access the instance with the
# instance class method.
class Foliater
include Singleton
# Loads the leaves specified in a given YAML file. See the READ... | Ruby |
#
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# < _ [ at ] dominiek.com > wrote this file. As long as you retain this notice you
# can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can bu... | Ruby |
require 'yaml'
require "#{$AL_ENV['root']}/libs/EyeAreSee"
# This is the superclass that all Autumn Leaves use. To write a leaf, sublcass
# this class and implement methods for each of your leaf's commands. Your leaf's
# repertoire of commands is derived from the names of the methods you write. For
# instance, to hav... | Ruby |
# Copyright (c)2004 David Heinemeier Hansson
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, pub... | Ruby |
require 'net/http'
# An autumn leaf used for an in-channel scorekeeping system. This is an open
# scorekeeping system: New members are added once they receive points for the
# first time, and anyone can add or remove points from anyone except themselves.
# There is no administrative functionality.
#
# *Usage*
#
# !poi... | Ruby |
#!/usr/bin/ruby
#
# Controller for the Autumn Leaves daemon. Starts, stops, and manages the
# daemon.
#
# Usage: big-switch.rb <command> <options> -- <application options>
#
# * where <command> is one of:
# start start an instance of the application
# stop stop all instances of the applicati... | Ruby |
#!/usr/bin/ruby
#
# Controller for the Autumn Leaves daemon. Starts, stops, and manages the
# daemon.
#
# Usage: big-switch.rb <command> <options> -- <application options>
#
# * where <command> is one of:
# start start an instance of the application
# stop stop all instances of the applicati... | Ruby |
# Loads configuration files, loads leaves and support files, then starts the
# Foliater.
require 'yaml'
# Add each_char method to String.
class String # :nodoc:
# Yields each character of the string as an Integer in succession.
def each_char
(0..(length-1)).each { |index| yield self[index] }
end
end
# Load... | Ruby |
true # placed here to prevent the class doc from becoming the file doc
# The Observant Squirrel is the logging class for leaves to use. This logger
# works very similarly to the Ruby on Rails logger. The logger uses five
# severity levels, +debug+, +info+, +warn+, and +error+ (in order). It will only
# log messages wh... | Ruby |
require 'yaml'
require 'singleton'
# Loads leaves and executes them in their own threads. Manages the threads and
# oversees all leaves. This is a singleton class; access the instance with the
# +instance+ class method.
class Foliater
include Singleton
# Loads the leaves specified in a given YAML file. See the RE... | Ruby |
#
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# < _ [ at ] dominiek.com > wrote this file. As long as you retain this notice you
# can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can bu... | Ruby |
require 'yaml'
require "#{$AL_ENV['root']}/libs/EyeAreSee"
# This is the superclass that all Autumn Leaves use. To write a leaf, sublcass
# this class and implement methods for each of your leaf's commands. Your leaf's
# repertoire of commands is derived from the names of the methods you write. For
# instance, to hav... | Ruby |
# This source file, originating from Ruby on Rails, extends the +Class+ class to
# allows attributes to be shared within an inheritance hierarchy, but where each
# descendant gets a copy of their parents' attributes, instead of just a pointer
# to the same. This means that the child can add elements to, for example, an... | Ruby |
require 'net/http'
# An Autumn Leaf used for an in-channel scorekeeping system. This is an open
# scorekeeping system: New members are added once they receive points for the
# first time, and anyone can add or remove points from anyone except themselves.
# There is no administrative functionality.
#
# *Usage*
#
# !poi... | Ruby |
require 'rake'
require 'facets/symbol/to_proc'
require 'facets/stylize'
require 'libs/genesis'
task :default do
puts 'Type "rake --tasks" to see a list of tasks you can perform.'
end
# Load the Autumn environment.
task :environment do
AL_ROOT = File.dirname(__FILE__)
@genesis = Autumn::Genesis.new
@genesis.lo... | Ruby |
#!/usr/bin/env ruby
#
# == Synopsis
#
# Destroys the files for leaves, seasons, and other objects of the Autumn
# framework.
#
# == Usage
#
# script/destroy <options> <object> <name>
#
# <object>:: The object type to destroy. Valid types are "leaf" and "season".
# <name>:: The name of the object to destroy. For example... | Ruby |
#!/usr/bin/env ruby
#
# Controller for the Autumn daemon. Starts, stops, and manages the daemon. Must
# be run from the Autumn root directory.
#
# Usage: script/daemon <command> <options> -- <application options>
#
# * where <command> is one of:
# start start an instance of the application
# stop ... | Ruby |
#!/usr/bin/env ruby
#
# Runs Autumn from the command line. This script will not exit until all leaves
# have exited. To use this script as a daemon, see the script/daemon script.
AL_ROOT = File.expand_path("#{File.dirname(__FILE__)}/..")
Dir.chdir AL_ROOT
require 'libs/genesis'
Autumn::Genesis.new.boot!
| Ruby |
#!/usr/bin/env ruby
#
# == Synopsis
#
# Generates template files for leaves, seasons, and other Autumn objects.
#
# == Usage
#
# script/generate <options> <template> <name>
#
# <template>:: The template to create. Valid templates are "leaf" and "season".
# <name>:: The name to give the created template. For example, yo... | Ruby |
#!/usr/bin/env ruby
#
# == Synopsis
#
# Destroys the files for leaves, seasons, and other objects of the Autumn
# framework.
#
# == Usage
#
# script/destroy <options> <object> <name>
#
# <object>:: The object type to destroy. Valid types are "leaf" and "season".
# <name>:: The name of the object to destroy. For example... | Ruby |
#!/usr/bin/env ruby
#
# == Synopsis
#
# Generates template files for leaves, seasons, and other Autumn objects.
#
# == Usage
#
# script/generate <options> <template> <name>
#
# <template>:: The template to create. Valid templates are "leaf" and "season".
# <name>:: The name to give the created template. For example, yo... | Ruby |
#!/usr/bin/env ruby
#
# Runs Autumn from the command line. This script will not exit until all leaves
# have exited. To use this script as a daemon, see the script/daemon script.
AL_ROOT = File.expand_path("#{File.dirname(__FILE__)}/..")
Dir.chdir AL_ROOT
require 'libs/genesis'
Autumn::Genesis.new.boot!
| Ruby |
#!/usr/bin/env ruby
#
# Controller for the Autumn daemon. Starts, stops, and manages the daemon. Must
# be run from the Autumn root directory.
#
# Usage: script/daemon <command> <options> -- <application options>
#
# * where <command> is one of:
# start start an instance of the application
# stop ... | Ruby |
require 'singleton'
require 'facets/hash/rekey'
require 'facets/hash/autonew'
require 'facets/symbol/to_proc'
module Autumn
# The Speciator stores the global, season, stem, and leaf configurations. It
# generates composite hashes, so that any leaf or stem can know its specific
# configuration as a combination o... | Ruby |
module Autumn
# A collection of convenience methods that are added to the Stem class. These
# methods serve two purposes; one, to allow easier backwards compatibility
# with Autumn Leaves 1.0 (which had a simpler one-stem-per-leaf approach), and
# two, to make it easier or more Ruby-like to perform certain I... | Ruby |
# Miscellaneous extra methods and objects used by Autumn.
require 'thread'
require 'facets/string/case'
require 'facets/stylize'
module Kernel # :nodoc:
# Bugfix for the Facets implementation of +respond+.
def respond(sym, *args)
return nil if not respond_to?(sym)
send(sym, *args)
end
end
class N... | Ruby |
require 'facets/array/only'
require 'facets/symbol/to_proc'
module Autumn # :nodoc:
# Helper class that generates shell Ruby code. This class knows how to
# generate Ruby code for template classes and methods.
class Coder # :nodoc:
# The generated code string.
attr :output
# Creates a new ... | Ruby |
require 'yaml'
require 'singleton'
require 'facets/stylize'
module Autumn
# Loads Stems and Leaves and executes them in their own threads. Manages the
# threads and oversees all leaves. This is a singleton class.
class Foliater
include Singleton
# The Speciator singleton.
attr_reader :config
... | Ruby |
require 'facets/string/partitions'
require 'facets/string/indexable'
require 'facets/array/only'
module Autumn
# Describes an IRC server daemon program. Different IRC servers run off of
# different IRC daemons, each of which has a slightly different implementation
# of the IRC protocol. To encapsulate this, t... | Ruby |
require 'time'
module Autumn
# A listener for a Stem that listens for and handles CTCP requests. You can
# add CTCP support for your IRC client by instantiating this object and
# passing it to the Stem#add_listener method.
#
# CTCP stands for Client-to-Client Protocol and is a way that IRC clients and
# s... | Ruby |
require 'getoptlong'
require 'rdoc/usage'
require 'libs/generator'
module Autumn # :nodoc:
# Manages data used by the script/generate and script/destroy scripts. This
# class is instantiated by the script, and manages the script's data and
# encapsulates common functionality between the two scripts. The objec... | Ruby |
module Autumn
# A special kind of leaf that only responds to messages sent to certain
# channels. Leaves that subclass ChannelLeaf can, in their leaves.yml config,
# specify a +channels+ option that narrows down which channels the leaf
# listens to. The leaf will not invoke the hook methods nor the
# <tt>*... | Ruby |
require 'thread'
require 'socket'
require 'openssl'
require 'facets/array/only'
require 'facets/symbol/to_proc'
require 'facets/enumerable/mash'
#require 'facets/kernel/respond'
require 'facets/string/indexable'
require 'facets/string/partitions'
require 'facets/annotations'
module Autumn
# A connection to an IRC... | Ruby |
require 'yaml'
require 'facets/stylize'
require 'libs/misc'
require 'libs/coder'
module Autumn # :nodoc:
# Generates the files for Autumn templates such as leaves and seasons. The
# contents of these template files are populated by an LeafCoder instance.
class Generator # :nodoc:
# The names of the req... | Ruby |
require 'facets/array/only'
module Autumn
# This class is a facade for Ruby's +Logger+ that adds additional information
# to log entries. LogFacade will pass any method calls onto a Logger instance,
# but reformat log entries to include an Autumn object's type and name.
#
# For example, if you wanted a Lo... | Ruby |
require 'rubygems'
require 'yaml'
require 'logger'
require 'libs/misc'
require 'libs/speciator'
module Autumn # :nodoc:
# Oversight class responsible for initializing the Autumn environment. To boot
# the Autumn environment start all configured leaves, you make an instance of
# this class and run the boot! me... | Ruby |
require 'yaml'
require 'timeout'
require 'facets/string/partitions'
require 'facets/array/only'
require 'facets/stylize'
require 'libs/formatting'
module Autumn
# This is the superclass that all Autumn leaves use. To write a leaf, sublcass
# this class and implement methods for each of your leaf's commands. You... | Ruby |
# This source file, originating from Ruby on Rails, extends the +Class+ class to
# allows attributes to be shared within an inheritance hierarchy, but where each
# descendant gets a copy of their parents' attributes, instead of just a pointer
# to the same. This means that the child can add elements to, for example, an... | Ruby |
module Autumn
# Adds text formatting to Autumn objects. Text formatting (color and styles)
# is not a part of the original IRC spec, so many clients have come up with
# many different ways of sending formatted text. The classes in this module
# encapsulate those various methods.
#
# To add formatting to ... | Ruby |
require 'data_mapper'
# Install the "chronic" gem for more robust date parsing
begin
gem 'chronic'
require 'chronic'
rescue Gem::LoadError
end
# An Autumn Leaf used for an in-channel scorekeeping system. This can operate
# both as an open or closed score system. (In the former, new members are
# automatically adde... | Ruby |
require 'facets/conversion'
# Utility methods used by Scorekeeper.
module ScorekeeperHelper
def parse_date(str)
date = nil
begin
date = Chronic.parse(str, :context => :past, :guess => false)
rescue NameError
begin
date = Date.parse(str)
rescue ArgumentError
end
end
... | Ruby |
# An IRC server and channel. The server property is of the form
# "[address]:[port]".
class Channel < DataMapper::Base
property :server, :string, :nullable => false
property :name, :string, :nullable => false
has_many :scores
end
| Ruby |
# A person's nickname. If someone changes a person's points using this nickname,
# the correct Person instance has their points changed.
class Pseudonym < DataMapper::Base
property :name, :string, :nullable => false
belongs_to :person
end
| Ruby |
# A change to a person's score.
class Score < DataMapper::Base
property :change, :integer, :nullable => false, :default => 0
property :note, :string
property :created_at, :datetime
belongs_to :giver, :class => 'Person'
belongs_to :receiver, :class => 'Person'
belongs_to :channel
end
| Ruby |
# An IRC member who can give or receive points.
class Person < DataMapper::Base
property :server, :string, :nullable => false
property :name, :string, :nullable => false
property :authorized, :boolean, :nullable => false, :default => true
has_many :scores, :class => 'Score', :foreign_key => 'receiver_id'
... | Ruby |
#!/usr/bin/ruby
#
# Controller for the Autumn Leaves daemon. Starts, stops, and manages the
# daemon.
#
# Usage: big-switch.rb <command> <options> -- <application options>
#
# * where <command> is one of:
# start start an instance of the application
# stop stop all instances of the applicati... | Ruby |
require 'rake'
require 'yaml'
# Load the AutumnLeaves environment.
task :environment do
# Load the global settings
root = File.dirname(__FILE__)
begin
$AL_ENV = YAML.load(File.open("#{root}/config/global.yml"))
rescue SystemCallError
raise "Couldn't find your global.yml file."
end
$AL_ENV['root'] =... | Ruby |
#!/usr/bin/ruby
#
# Controller for the Autumn Leaves daemon. Starts, stops, and manages the
# daemon.
#
# Usage: big-switch.rb <command> <options> -- <application options>
#
# * where <command> is one of:
# start start an instance of the application
# stop stop all instances of the applicati... | Ruby |
# Loads configuration files, loads leaves and support files, then starts the
# Foliater.
require 'yaml'
# Add each_char method to String.
class String # :nodoc:
# Yields each character of the string as an Integer in succession.
def each_char
(0..(length-1)).each { |index| yield self[index] }
end
end
# Load... | Ruby |
true # placed here to prevent the class doc from becoming the file doc
# The Observant Squirrel is the logging class for leaves to use. This logger
# works very similarly to the Ruby on Rails logger. The logger uses five
# severity levels, +debug+, +info+, +warn+, and +error+ (in order). It will only
# log messages wh... | Ruby |
require 'yaml'
require 'singleton'
# Loads leaves and executes them in their own threads. Manages the threads and
# oversees all leaves. This is a singleton class; access the instance with the
# +instance+ class method.
class Foliater
include Singleton
# Loads the leaves specified in a given YAML file. See the RE... | Ruby |
#
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# < _ [ at ] dominiek.com > wrote this file. As long as you retain this notice you
# can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can bu... | Ruby |
require 'yaml'
require "#{$AL_ENV['root']}/libs/EyeAreSee"
# This is the superclass that all Autumn Leaves use. To write a leaf, sublcass
# this class and implement methods for each of your leaf's commands. Your leaf's
# repertoire of commands is derived from the names of the methods you write. For
# instance, to hav... | Ruby |
# This source file, originating from Ruby on Rails, extends the +Class+ class to
# allows attributes to be shared within an inheritance hierarchy, but where each
# descendant gets a copy of their parents' attributes, instead of just a pointer
# to the same. This means that the child can add elements to, for example, an... | Ruby |
# An Autumn Leaf used for an in-channel scorekeeping system. This is an open
# scorekeeping system: New members are added once they receive points for the
# first time, and anyone can add or remove points from anyone except themselves.
# There is no administrative functionality.
#
# *Usage*
#
# !points [name]:: Get a p... | Ruby |
# An IRC server and channel. The server property is of the form
# "[address]:[port]".
class Channel < DataMapper::Base
property :server, :string, :nullable => false
property :name, :string, :nullable => false
has_many :scores
end
| Ruby |
# A person's nickname. If someone changes a person's points using this nickname,
# the correct Person instance has their points changed.
class Pseudonym < DataMapper::Base
property :name, :string, :nullable => false
belongs_to :person
end
| Ruby |
require 'facets/conversion'
# Utility methods used by Scorekeeper.
module ScorekeeperHelper
def parse_date(str)
date = nil
begin
date = Chronic.parse(str, :context => :past, :guess => false)
rescue NameError
begin
date = Date.parse(str)
rescue ArgumentError
end
end
... | Ruby |
# A change to a person's score.
class Score < DataMapper::Base
property :change, :integer, :nullable => false, :default => 0
property :note, :string
property :created_at, :datetime
belongs_to :giver, :class => 'Person'
belongs_to :receiver, :class => 'Person'
belongs_to :channel
end
| Ruby |
# An IRC member who can give or receive points.
class Person < DataMapper::Base
property :server, :string, :nullable => false
property :name, :string, :nullable => false
property :authorized, :boolean, :nullable => false, :default => true
has_many :scores, :class => 'Score', :foreign_key => 'receiver_id'
... | Ruby |
require 'rake'
require 'facets/symbol/to_proc'
require 'facets/stylize'
require 'libs/genesis'
task :default do
puts 'Type "rake --tasks" to see a list of tasks you can perform.'
end
# Load the Autumn environment.
task :environment do
AL_ROOT = File.dirname(__FILE__)
@genesis = Autumn::Genesis.new
@genesis.lo... | Ruby |
#!/usr/bin/env ruby
#
# == Synopsis
#
# Destroys the files for leaves, seasons, and other objects of the Autumn
# framework.
#
# == Usage
#
# script/destroy <options> <object> <name>
#
# <object>:: The object type to destroy. Valid types are "leaf" and "season".
# <name>:: The name of the object to destroy. For example... | Ruby |
#!/usr/bin/env ruby
#
# Controller for the Autumn daemon. Starts, stops, and manages the daemon. Must
# be run from the Autumn root directory.
#
# Usage: script/daemon <command> <options> -- <application options>
#
# * where <command> is one of:
# start start an instance of the application
# stop ... | Ruby |
#!/usr/bin/env ruby
#
# Runs Autumn from the command line. This script will not exit until all leaves
# have exited. To use this script as a daemon, see the script/daemon script.
AL_ROOT = File.expand_path("#{File.dirname(__FILE__)}/..")
Dir.chdir AL_ROOT
require 'libs/genesis'
Autumn::Genesis.new.boot!
| Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.