Add ruby-irc, an IRC client framework for Ruby.

Currently few English documents are bundled.  For the time being, try
the bot.rb (and cpi/*.cpi) example I translated into English to see
how it works.
This commit is contained in:
Akinori MUSHA 2001-01-19 09:00:21 +00:00
parent 6ba9624592
commit d8fdbb29db
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=37323
15 changed files with 299 additions and 0 deletions

View File

@ -22,6 +22,7 @@
SUBDIR += party
SUBDIR += quirc
SUBDIR += roxirc
SUBDIR += ruby-irc
SUBDIR += scrollz
SUBDIR += sic
SUBDIR += sirc

50
irc/ruby-irc/Makefile Normal file
View File

@ -0,0 +1,50 @@
# New ports collection makefile for: Ruby/IRC
# Date created: 19 Jan 2001
# Whom: Akinori MUSHA aka knu <knu@idaemons.org>
#
# $FreeBSD$
#
PORTNAME= irc
PORTVERSION= 0.13
CATEGORIES= irc ruby
MASTER_SITES= http://www.ueda.info.waseda.ac.jp/~igarashi/ruby/
PKGNAMEPREFIX= ${RUBY_PKGNAMEPREFIX}
DISTNAME= ruby-${PORTNAME}-${PORTVERSION}
DIST_SUBDIR= ruby
MAINTAINER= knu@FreeBSD.org
USE_RUBY= yes
NO_BUILD= yes
DOCS_EN= BUGS ChangeLog MANIFEST \
NEWS README TODO
DOCS_JA= MEMO.ja README.ja
do-install:
${INSTALL_DATA} ${WRKSRC}/localize.rb ${RUBY_SITELIBDIR}
${MKDIR} ${RUBY_SITELIBDIR}/irc
${INSTALL_DATA} ${WRKSRC}/irc/*.rb ${RUBY_SITELIBDIR}/irc/
.if !defined(NOPORTDOCS)
${MKDIR} ${RUBY_DOCDIR}/irc/ja
.for f in ${DOCS_EN}
${INSTALL_DATA} ${WRKSRC}/${f} ${RUBY_DOCDIR}/irc/
.endfor
.for f in ${DOCS_JA}
${INSTALL_DATA} ${WRKSRC}/${f} ${RUBY_DOCDIR}/irc/ja/
.endfor
${INSTALL_DATA} ${WRKSRC}/doc/* ${RUBY_DOCDIR}/irc/ja/
${MKDIR} ${RUBY_EXAMPLESDIR}/irc/cpi
${MKDIR} ${RUBY_EXAMPLESDIR}/irc/ja/cpi
cd ${WRKSRC}/cpi && \
for f in *.cpi; do ${INSTALL_DATA} $${f} ${RUBY_EXAMPLESDIR}/irc/cpi/; done; \
for f in *.cpi.orig; do ${INSTALL_DATA} $${f} ${RUBY_EXAMPLESDIR}/irc/ja/cpi/$${f%.orig}; done
${INSTALL_DATA} ${WRKSRC}/bot.rb ${RUBY_EXAMPLESDIR}/irc/
${INSTALL_DATA} ${WRKSRC}/bot.rb.orig ${RUBY_EXAMPLESDIR}/irc/ja/bot.rb
${MKDIR} ${RUBY_EXAMPLESDIR}/irc/log
${MKDIR} ${RUBY_EXAMPLESDIR}/irc/ja/log
.endif
.include <bsd.port.mk>

1
irc/ruby-irc/distinfo Normal file
View File

@ -0,0 +1 @@
MD5 (ruby/ruby-irc-0.13.tar.gz) = 345c5cd815cd72dd09110f8faa1f8634

View File

@ -0,0 +1,11 @@
--- bot.rb.orig Wed Jun 14 05:12:45 2000
+++ bot.rb Fri Jan 19 17:17:42 2001
@@ -30,7 +30,7 @@
parseArgs(0, "server", "",
"server:", "logfile:", "nick:", "operator:", "username:")
Server = $OPT_server
-Operator = $OPT_operator || "Igapon"
+Operator = $OPT_operator || "igapon!igarashi@mahon.ueda.info.waseda.ac.jp"
Nick = $OPT_nick || "Bot"
UserName = $OPT_username || "iga"
AgentName = $OPT_agentname || "Ruby¤Á¤ã¤ó"

View File

@ -0,0 +1,11 @@
--- cpi/operator.cpi.orig Wed Jun 14 10:03:51 2000
+++ cpi/operator.cpi Fri Jan 19 17:15:50 2001
@@ -15,7 +15,7 @@
include IRC
def start(client)
super
- @operator = User.parse("igapon!igarashi@mahon.ueda.info.waseda.ac.jp")
+ @operator = User.parse(Operator)
report("こんにちわ")
end
def stop

View File

@ -0,0 +1,5 @@
--- bot.rb.orig Wed Jun 14 05:12:45 2000
+++ bot.rb Fri Jan 19 16:53:24 2001
@@ -36 +36 @@
-AgentName = $OPT_agentname || "Rubyちゃん"
+AgentName = $OPT_agentname || "Ruby-chan"

View File

@ -0,0 +1,27 @@
--- cpi/dice.cpi.orig Tue Jun 13 00:52:00 2000
+++ cpi/dice.cpi Fri Jan 19 16:54:24 2001
@@ -3 +3 @@
-#さいころ振りエージェント
+# "Dice Thrower" agent
@@ -11 +11 @@
-#このスクリプトは
+#This script was translated from a perl script:
@@ -15 +14,0 @@
-#を移植させて頂いたものです。
@@ -17 +16 @@
-#"2d6"のような表現に反応し、さいころを振ってくれます。
+#It responds to phrases like "2d6" and throws dice.
@@ -20 +19 @@
-agent = IRC::PassiveAgent::new("さいころ振り")
+agent = IRC::PassiveAgent::new("Dice Thrower")
@@ -41,5 +40,5 @@
- 'だいすのかずがへんですぅ',
- 'そのだいすはもってないですぅ',
- 'そんなにたくさんもってないですぅ~',
- 'だいすがつくえからおちたですぅ',
- '0 ではわれないですぅ~',
+ 'The number of dice is invalid.',
+ 'Sorry, I don\'t have such kind of dice.',
+ 'Sorry, I don\'t have so many dice.',
+ 'Oops, dice fell out of the table!',
+ 'Divided by zero.',

View File

@ -0,0 +1,18 @@
--- cpi/init.cpi.orig Tue Jun 13 00:52:00 2000
+++ cpi/init.cpi Fri Jan 19 16:20:28 2001
@@ -3 +3 @@
-#初期化スクリプト
+#Initialization
@@ -12,2 +12,2 @@
-# ここではIRC::Clientクラスのメソッドが利用できます。
-# IRC::Client#startAgentを呼び出してプラグインエージェントを起動できます。
+# You can invoke the methods of the class IRC::Client.
+# Invoke IRC::Client#startAgent to run each plug-in agent.
@@ -16 +16 @@
-# エージェントの起動
+# Invocation of agents
@@ -24,2 +24,2 @@
-# nilを返すことにより、1度きりの実行となる。
-# 登録されることはない。
+# Returning nil means "run me just once"
+# so as not to registered as a resident agent.

View File

@ -0,0 +1,36 @@
--- cpi/omikuji.cpi.orig Tue Jun 13 00:52:00 2000
+++ cpi/omikuji.cpi Fri Jan 19 17:07:00 2001
@@ -3 +3 @@
-#おみくじエージェント
+#Omikuji - Fortuneteller agent
@@ -11 +11 @@
-agent = IRC::PassiveAgent::new("おみくじ")
+gent = IRC::PassiveAgent::new("Fortuneteller")
@@ -26 +26 @@
- if message.trailing =~ /^(?:\s| )*おみくじ(?:\s| )*$/
+ if message.trailing =~ /^(?:\s| )*(?:Fortune|Omikuji)(?:\s| )*$/
@@ -38,2 +38,2 @@
-#from:String おみくじを引いた人
-#to:String 結果の送り先
+#from:String - Consultee
+#to:String - Recipient
@@ -41,2 +41,2 @@
- privmsg("おみくじ引きまぁす。", to)
- privmsg("#{from}さんの運勢は……", to)
+ privmsg("Consulting an oracle.", to)
+ privmsg("Reading #{from}'s fortune...", to)
@@ -48 +48 @@
- "大吉でぇす!!"
+ "Best Luck!!!"
@@ -50 +50 @@
- "中吉でぇす!"
+ "Good Luck!!"
@@ -52 +52 @@
- "小吉でぇす!"
+ "Not Much Luck!"
@@ -54 +54 @@
- "凶でぇす!"
+ "Bad Luck!"
@@ -56 +56 @@
- "大凶でぇす!"
+ "Worst Luck!!"

View File

@ -0,0 +1,75 @@
--- cpi/operator.cpi.orig Wed Jun 14 10:03:51 2000
+++ cpi/operator.cpi Fri Jan 19 16:20:28 2001
@@ -3,2 +3,2 @@
-#Operator命令処理エージェント
-# ぷりぶで来た!ではじまる命令に反応します。
+#Command Executer
+# This agent responds to privmsg's from the operator that start with "!" and execute the commands.
@@ -12 +12 @@
-agent = IRC::PassiveAgent::new("Operator命令")
+agent = IRC::PassiveAgent::new("CommandExecuter")
@@ -19 +19 @@
- report("こんにちわ")
+ report("Hello, sir.")
@@ -36 +36 @@
- report("#{user}さんが「#{str}」だって。")
+ report("#{user} commanded me \"#{str}\".")
@@ -44 +44 @@
- privmsg(""+str, @operator.nick)
+ privmsg("!"+str, @operator.nick)
@@ -51 +51 @@
- when /\A(?:quit|停止|ばいばい)\Z/
+ when /\Aquit\Z/
@@ -53 +53 @@
- when /\A(?:reboot|再起動)\Z/
+ when /\Areboot\Z/
@@ -55 +55 @@
- when /\A(?:エージェント|えーじぇんと|listAgent)\Z/
+ when /\AlistAgent\Z/
@@ -57 +57 @@
- when /\A(?:restartAgent|えーじぇんとさいきどう|エージェント再起動)[\s ]+(\w+)\Z/
+ when /\ArestartAgent[\s ]+(\w+)\Z/
@@ -59 +59 @@
- when /\A(?:channels|ちゃんねる|チャンネル)\Z/
+ when /\Achannels\Z/
@@ -61 +61 @@
- when /\A(?:invite|おいで)[\s ]+(\S+)\Z/
+ when /\Ainvite[\s ]+(\S+)\Z/
@@ -64 +64 @@
- report("ほえ?")
+ report("Beg your pardon, sir?")
@@ -71 +71 @@
- report("ばいば~い☆")
+ report("I am leaving, sir!")
@@ -83 +83 @@
- # エージェント:一覧
+ # List agents
@@ -85 +85 @@
- report("エージェント一覧:")
+ report("List of agents:")
@@ -91 +91 @@
- report("(エージェント一覧ここまで)")
+ report("(End of list)")
@@ -94 +94 @@
- # エージェント:再起動
+ # Restart an agent
@@ -98 +98 @@
- report("エージェント[#{new_agent.nick}]を再起動しました。")
+ report("Agent [#{new_agent.nick}] has been restarted.")
@@ -102 +102 @@
- # 自分の入っているチャンネル
+ # List channels it's joining
@@ -106 +106 @@
- report("今入っているちゃんねるは")
+ report("I am joining the channels: ")
@@ -108 +107,0 @@
- report("だよ。")
@@ -110 +109 @@
- report("今どのチャンネルにも入ってないよ")
+ report("I am not joining any channels.")
@@ -115 +114 @@
- report(channel+"にいきます。")
+ report("I'm coming to "+channel)
@@ -117 +116 @@
- privmsg("こんにちわ、おじゃましま~す☆(試験運転中です)", channel)
+ privmsg("Hello, excuse me to interrupting you. (I am in experimental service)", channel)

View File

@ -0,0 +1,8 @@
--- cpi/syslog.cpi.orig Tue Jun 13 00:52:00 2000
+++ cpi/syslog.cpi Fri Jan 19 16:20:28 2001
@@ -13 +13 @@
-agent = IRC::PassiveAgent::new("syslog")
+agent = IRC::PassiveAgent::new("Syslog")
@@ -27 +27 @@
- buf = log.timestamp.strftime("%m月%d日%H時%M分")
+ buf = log.timestamp.strftime("%m/%d %H:%M")

View File

@ -0,0 +1,11 @@
--- cpi/userlog.cpi.orig Tue Jun 13 00:52:00 2000
+++ cpi/userlog.cpi Fri Jan 19 16:20:28 2001
@@ -3 +3 @@
-# ユーザ定義のlogger
+# User defined logger
@@ -11 +11 @@
-agent = IRC::PassiveAgent::new("ログ取り")
+agent = IRC::PassiveAgent::new("Logger")
@@ -25 +25 @@
- buf = log.timestamp.strftime("%m月%d日%H時%M分")
+ buf = log.timestamp.strftime("%m/%d %H:%M")

1
irc/ruby-irc/pkg-comment Normal file
View File

@ -0,0 +1 @@
IRC client framework for Ruby

3
irc/ruby-irc/pkg-descr Normal file
View File

@ -0,0 +1,3 @@
Ruby/IRC is an IRC client framework for Ruby.
Author: Hiroshi IGARASHI <igarashi@ueda.info.waseda.ac.jp>

41
irc/ruby-irc/pkg-plist Normal file
View File

@ -0,0 +1,41 @@
%%RUBY_SITELIBDIR%%/irc/agent.rb
%%RUBY_SITELIBDIR%%/irc/client.rb
%%RUBY_SITELIBDIR%%/irc/const.rb
%%RUBY_SITELIBDIR%%/irc/irc.rb
@dirrm %%RUBY_SITELIBDIR%%/irc
%%RUBY_SITELIBDIR%%/localize.rb
%%RUBY_DOCDIR%%/irc/BUGS
%%RUBY_DOCDIR%%/irc/ChangeLog
%%RUBY_DOCDIR%%/irc/MANIFEST
%%RUBY_DOCDIR%%/irc/NEWS
%%RUBY_DOCDIR%%/irc/README
%%RUBY_DOCDIR%%/irc/TODO
%%RUBY_DOCDIR%%/irc/ja/MEMO.ja
%%RUBY_DOCDIR%%/irc/ja/README.ja
%%RUBY_DOCDIR%%/irc/ja/index.html
%%RUBY_DOCDIR%%/irc/ja/irc-client.doc
%%RUBY_DOCDIR%%/irc/ja/irc-client-api.doc
%%RUBY_DOCDIR%%/irc/ja/irc-lib-api.doc
%%RUBY_DOCDIR%%/irc/ja/irc-lib.doc
@dirrm %%RUBY_DOCDIR%%/irc/ja
@dirrm %%RUBY_DOCDIR%%/irc
%%RUBY_EXAMPLESDIR%%/irc/ja/cpi/dice.cpi
%%RUBY_EXAMPLESDIR%%/irc/ja/cpi/init.cpi
%%RUBY_EXAMPLESDIR%%/irc/ja/cpi/omikuji.cpi
%%RUBY_EXAMPLESDIR%%/irc/ja/cpi/operator.cpi
%%RUBY_EXAMPLESDIR%%/irc/ja/cpi/syslog.cpi
%%RUBY_EXAMPLESDIR%%/irc/ja/cpi/userlog.cpi
%%RUBY_EXAMPLESDIR%%/irc/ja/bot.rb
@dirrm %%RUBY_EXAMPLESDIR%%/irc/ja/cpi
@dirrm %%RUBY_EXAMPLESDIR%%/irc/ja/log
@dirrm %%RUBY_EXAMPLESDIR%%/irc/ja
%%RUBY_EXAMPLESDIR%%/irc/cpi/dice.cpi
%%RUBY_EXAMPLESDIR%%/irc/cpi/init.cpi
%%RUBY_EXAMPLESDIR%%/irc/cpi/omikuji.cpi
%%RUBY_EXAMPLESDIR%%/irc/cpi/operator.cpi
%%RUBY_EXAMPLESDIR%%/irc/cpi/syslog.cpi
%%RUBY_EXAMPLESDIR%%/irc/cpi/userlog.cpi
%%RUBY_EXAMPLESDIR%%/irc/bot.rb
@dirrm %%RUBY_EXAMPLESDIR%%/irc/cpi
@dirrm %%RUBY_EXAMPLESDIR%%/irc/log
@dirrm %%RUBY_EXAMPLESDIR%%/irc