Permalink
Browse files

weee

  • Loading branch information...
0 parents commit 2d9d387357a33979ea3248998005f227155a0a78 @radar radar committed Jan 1, 2009
Showing with 8,333 additions and 0 deletions.
  1. +5 −0 .gitignore
  2. +1,124 −0 README
  3. +1,159 −0 README.textile
  4. +135 −0 Rakefile
  5. +2 −0 config/global.yml
  6. +5 −0 config/seasons/logga/leaves.yml
  7. +2 −0 config/seasons/logga/season.yml
  8. +8 −0 config/seasons/logga/stems.yml
  9. +20 −0 leaves/administrator/README
  10. +67 −0 leaves/administrator/controller.rb
  11. 0 leaves/administrator/data/.gitignore
  12. 0 leaves/administrator/helpers/.gitignore
  13. 0 leaves/administrator/models/.gitignore
  14. 0 leaves/administrator/tasks/.gitignore
  15. +1 −0 leaves/administrator/views/autumn.txt.erb
  16. +11 −0 leaves/administrator/views/reload.txt.erb
  17. +1 −0 leaves/logga/README
  18. +363 −0 leaves/logga/controller.rb
  19. +5 −0 leaves/logga/models/chat.rb
  20. +5 −0 leaves/logga/models/constant.rb
  21. +3 −0 leaves/logga/models/day.rb
  22. +4 −0 leaves/logga/models/entry.rb
  23. +3 −0 leaves/logga/models/hostname.rb
  24. +13 −0 leaves/logga/models/person.rb
  25. +3 −0 leaves/logga/models/tip.rb
  26. +3 −0 leaves/logga/models/user.rb
  27. +8 −0 leaves/logga/models/vote.rb
  28. +1 −0 leaves/logga/views/about.txt.erb
  29. +237 −0 libs/authentication.rb
  30. +107 −0 libs/channel_leaf.rb
  31. +166 −0 libs/coder.rb
  32. +10 −0 libs/console_boot.rb
  33. +250 −0 libs/ctcp.rb
  34. +207 −0 libs/daemon.rb
  35. +287 −0 libs/datamapper_hacks.rb
  36. +221 −0 libs/foliater.rb
  37. +236 −0 libs/formatting.rb
  38. +231 −0 libs/generator.rb
  39. +182 −0 libs/genesis.rb
  40. +162 −0 libs/inheritable_attributes.rb
  41. +738 −0 libs/leaf.rb
  42. +49 −0 libs/log_facade.rb
  43. +87 −0 libs/misc.rb
  44. +74 −0 libs/script.rb
  45. +165 −0 libs/speciator.rb
  46. +908 −0 libs/stem.rb
  47. +176 −0 libs/stem_facade.rb
  48. +3 −0 resources/daemons/Anothernet.yml
  49. +29 −0 resources/daemons/AustHex.yml
  50. +67 −0 resources/daemons/Bahamut.yml
  51. +3 −0 resources/daemons/Dancer.yml
  52. +3 −0 resources/daemons/GameSurge.yml
  53. +3 −0 resources/daemons/IRCnet.yml
  54. +7 −0 resources/daemons/Ithildin.yml
  55. +56 −0 resources/daemons/KineIRCd.yml
  56. +6 −0 resources/daemons/PTlink.yml
  57. +20 −0 resources/daemons/QuakeNet.yml
  58. +158 −0 resources/daemons/RFC1459.yml
  59. +16 −0 resources/daemons/RFC2811.yml
  60. +36 −0 resources/daemons/RFC2812.yml
  61. +25 −0 resources/daemons/RatBox.yml
  62. +24 −0 resources/daemons/Ultimate.yml
  63. +6 −0 resources/daemons/Undernet.yml
  64. +110 −0 resources/daemons/Unreal.yml
  65. +7 −0 resources/daemons/_Other.yml
  66. +33 −0 resources/daemons/aircd.yml
  67. +3 −0 resources/daemons/bdq-ircd.yml
  68. +38 −0 resources/daemons/hybrid.yml
  69. +67 −0 resources/daemons/ircu.yml
  70. +8 −0 resources/daemons/tr-ircd.yml
  71. +26 −0 script/console
  72. +27 −0 script/daemon
  73. +48 −0 script/destroy
  74. +48 −0 script/generate
  75. +12 −0 script/server
  76. 0 shared/.gitignore
@@ -0,0 +1,5 @@
+config/seasons/helpa/database.yml
+config/seasons/helpa/stems.yml
+log/*
+tmp/*
+doc/*
1,124 README

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.
135 Rakefile
@@ -0,0 +1,135 @@
+require 'rake'
+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.load_global_settings
+ @genesis.load_season_settings
+end
+
+task :boot do
+ AL_ROOT = File.dirname(__FILE__)
+ @genesis = Autumn::Genesis.new
+ @genesis.boot! false
+end
+
+namespace :app do
+ desc "Launch the Autumn daemon"
+ task :start do
+ system 'script/daemon start'
+ end
+
+ desc "Stop the Autumn daemon"
+ task :stop do
+ system 'script/daemon stop'
+ end
+
+ desc "Restart the Autumn daemon"
+ task :restart do
+ system 'script/daemon restart'
+ end
+
+ desc "Start Autumn but not as a daemon (stay on top)"
+ task :run do
+ system 'script/daemon run'
+ end
+
+ desc "Force the daemon to a stopped state (clears PID files)"
+ task :zap do
+ system 'script/daemon zap'
+ end
+end
+
+namespace :log do
+ desc "Remove all log files"
+ task :clear do
+ system 'rm -vf tmp/*.log tmp/*.output log/*.log*'
+ end
+
+ desc "Print all error messages in the log files"
+ task :errors => :environment do
+ season_log = "log/#{@genesis.config.global :season}.log"
+ system_log = 'tmp/autumn.log'
+ if File.exists? season_log then
+ puts "==== ERROR-LEVEL LOG MESSAGES ===="
+ File.open(season_log, 'r') do |log|
+ puts log.grep(/^[EF],/)
+ end
+ end
+ if File.exists? system_log then
+ puts "==== UNCAUGHT EXCEPTIONS ===="
+ File.open(system_log, 'r') do |log|
+ puts log.grep(/^[EF],/)
+ end
+ end
+ end
+end
+
+def local_db?(db)
+ db.host.nil? or db.host == 'localhost'
+end
+
+namespace :db do
+ desc "Recreate database tables according to the model objects"
+ task :migrate => :boot do
+ dname = ENV['DB']
+ raise "Usage: DB=[Database config name] rake db:migrate" unless dname
+ raise "Unknown database config #{dname}" unless database = repository(dname.to_sym)
+ puts "Migrating the #{dname} database..."
+ # Find models that have definitions for the selected database and migrate them
+ repository(dname.to_sym) do
+ repository(dname.to_sym).models.each { |mod| mod.auto_migrate! dname.to_sym }
+ end
+ end
+ desc "Nondestructively update database tables according to the model objects"
+ task :upgrade => :boot do
+ dname = ENV['DB']
+ raise "Usage: DB=[Database config name] rake db:upgrade" unless dname
+ raise "Unknown database config #{dname}" unless database = repository(dname.to_sym)
+ puts "Upgrading the #{dname} database..."
+ # Find models that have definitions for the selected database and upgrade them
+ repository(dname.to_sym) do
+ repository(dname.to_sym).models.each { |mod| mod.auto_upgrade! dname.to_sym }
+ end
+ end
+end
+
+namespace :doc do
+ desc "Generate API documentation for Autumn"
+ task :api => :environment do
+ FileUtils.remove_dir 'doc/api' if File.directory? 'doc/api'
+ system "rdoc --main README --title 'Autumn API Documentation' -o doc/api --line-numbers --inline-source libs README"
+ end
+
+ desc "Generate documentation for all leaves"
+ task :leaves => :environment do
+ FileUtils.remove_dir 'doc/leaves' if File.directory? 'doc/leaves'
+ Dir.glob("leaves/*").each do |leaf_dir|
+ Dir.chdir leaf_dir do
+ system "rdoc --main README --title '#{File.basename(leaf_dir).camelcase} Documentation' -o ../../doc/leaves/#{File.basename leaf_dir} --line-numbers --inline-source controller.rb helpers models README"
+ end
+ end
+ end
+
+ desc "Remove all documentation"
+ task :clear => :environment do
+ FileUtils.remove_dir 'doc/api' if File.directory? 'doc/api'
+ FileUtils.remove_dir 'doc/leaves' if File.directory? 'doc/leaves'
+ end
+end
+
+# Load any custom Rake tasks in the bot's tasks directory.
+Dir["leaves/*"].each do |leaf|
+ leaf_name = File.basename(leaf, ".rb").downcase
+ namespace leaf_name.to_sym do # Tasks are placed in a namespace named after the leaf
+ FileList["leaves/#{leaf_name}/tasks/**/*.rake"].sort.each do |task|
+ load task
+ end
+ end
+end
@@ -0,0 +1,2 @@
+---
+season: logga
@@ -0,0 +1,5 @@
+Logga:
+ class: Logga
+ # authentication:
+ # type: nick
+ # nick: Radar
@@ -0,0 +1,2 @@
+---
+logging: debug
@@ -0,0 +1,8 @@
+---
+Example:
+ nick: logga
+ leaves:
+ - Logga
+ rejoin: true
+ channel: "#logga"
+ server: irc.freenode.net
@@ -0,0 +1,20 @@
+= Administrator: An Autumn Leaf
+
+<b>Version 1.0 (Jul 8, 2008)</b>
+
+Author:: Tim Morgan (mailto:riscfuture@gmail.com)
+Copyright:: Copyright (c)2008 Tim Morgan
+License:: Distributed under the same terms as Ruby.
+
+This leaf allows the owner of the IRC bot to perform administrative commands on
+the bot, such as quitting or reloading it. In order to protect such commands
+from abuse, this bot uses the Authenticator module. The Authenticator method
+that is used is specified by the +authentication+ option. For more information,
+see the *Authentication* section of the README.
+
+== Usage
+
+!autumn:: Displays information about the version of Autumn that is running this
+ leaf (unprotected command).
+!quit:: Terminates the stem on which the message was received.
+!reload:: Reloads all source files of all leaves, and all their view files.
@@ -0,0 +1,67 @@
+# Controller for the Administrator leaf.
+
+class Controller < Autumn::Leaf
+
+ # Typing this command reloads all source code for all leaves and support
+ # files, allowing you to make "on-the-fly" changes without restarting the
+ # process. It does this by reloading the source files defining the classes.
+ #
+ # If you supply the configuration name of a leaf, only that leaf is reloaded.
+ #
+ # This command does not reload the YAML configuration files, only the source
+ # code.
+
+ def reload_command(stem, sender, reply_to, msg)
+ var :leaves => Hash.new
+ if msg then
+ if Foliater.instance.leaves.include?(msg) then
+ begin
+ Foliater.instance.hot_reload Foliater.instance.leaves[msg]
+ rescue
+ logger.error "Error when reloading #{msg}:"
+ logger.error $!
+ var(:leaves)[msg] = $!.to_s
+ else
+ var(:leaves)[msg] = false
+ end
+ logger.info "#{msg}: Reloaded"
+ else
+ var :not_found => msg
+ end
+ else
+ Foliater.instance.leaves.each do |name, leaf|
+ begin
+ Foliater.instance.hot_reload leaf
+ rescue
+ logger.error "Error when reloading #{name}:"
+ logger.error $!
+ var(:leaves)[name] = $!.to_s
+ else
+ var(:leaves)[name] = false
+ end
+ logger.info "#{name}: Reloaded"
+ end
+ end
+ end
+ ann :reload_command, :protected => true
+
+ # Typing this command will cause the Stem to exit.
+
+ def quit_command(stem, sender, reply_to, msg)
+ stem.quit
+ end
+ ann :quit_command, :protected => true
+
+ # Typing this command will display information about the version of Autumn
+ # that is running this leaf.
+
+ def autumn_command(stem, sender, reply_to, msg)
+ var :version => AUTUMN_VERSION
+ end
+
+ # Suppress the !commands command; don't want to publicize the administrative
+ # features.
+
+ def commands_command(stem, sender, reply_to, msg)
+ end
+end
No changes.
No changes.
No changes.
No changes.
@@ -0,0 +1 @@
+Autumn version <%= var :version %>, an IRC bot framework for Ruby (http://github.com/RISCfuture/autumn).
@@ -0,0 +1,11 @@
+<% if var(:not_found) %>
+ There is no leaf named <%= var :not_found %>.
+<% else %>
+ <% var(:leaves).each do |leaf, error| %>
+ <% if error %>
+ <%= leaf %> couldn't be reloaded: <%= error %>
+ <% else %>
+ <%= leaf %> was reloaded successfully.
+ <% end %>
+ <% end %>
+<% end %>
@@ -0,0 +1 @@
+This is the read-me for your leaf.
Oops, something went wrong.

0 comments on commit 2d9d387

Please sign in to comment.