summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPav Lucistnik <pav@FreeBSD.org>2004-03-27 16:04:40 +0000
committerPav Lucistnik <pav@FreeBSD.org>2004-03-27 16:04:40 +0000
commite96f1d48d68a59d6b4e6009229d3cbd9ab54aa81 (patch)
treeed70a969709e40f9ea3788a0f5f87e97ce7ca544
parentCorrect plist entry. (diff)
- Runtime fixes for ruby-1.8
- Raise PORTREVISION PR: ports/64782, ports/64789 Submitted by: David Bushong <david+ports@bushong.net> (maintainer)
-rw-r--r--irc/rbot/Makefile4
-rw-r--r--irc/rbot/files/patch-18-syntax123
-rw-r--r--irc/rbot/files/patch-dice-roll18
-rw-r--r--irc/rbot/files/patch-karma14
-rw-r--r--irc/rbot/files/patch-lart-suth18
-rw-r--r--irc/rbot/files/patch-math28
-rw-r--r--irc/rbot/files/patch-url11
-rw-r--r--irc/rbot/pkg-descr21
-rw-r--r--irc/rbot/pkg-message4
-rw-r--r--irc/rbot/pkg-plist1
10 files changed, 221 insertions, 21 deletions
diff --git a/irc/rbot/Makefile b/irc/rbot/Makefile
index 1bc8a77d11ce..b74ac318c71b 100644
--- a/irc/rbot/Makefile
+++ b/irc/rbot/Makefile
@@ -7,6 +7,7 @@
PORTNAME= rbot
PORTVERSION= 0.9.6
+PORTREVISION= 1
CATEGORIES= irc ruby
MASTER_SITES= http://linuxbrit.co.uk/downloads/
@@ -22,6 +23,8 @@ NO_BUILD= yes
post-patch:
@${RUBY} -pi -e 'sub /rbotconf/, "${PREFIX}/etc/rbot"' ${WRKSRC}/rbot.rb
+ @rm ${WRKSRC}/rbot/*.orig
+ @rm ${WRKSRC}/rbot/plugins/*.orig
do-install:
${INSTALL_SCRIPT} ${WRKSRC}/rbot.rb ${PREFIX}/bin/rbot
@@ -34,5 +37,6 @@ do-install:
( cd ${WRKSRC}/doc && ${TAR} -cf - * ) | \
${TAR} -C ${RUBY_MODDOCDIR} -xpf -
.endif
+ @${CAT} ${PKGMESSAGE}
.include <bsd.port.mk>
diff --git a/irc/rbot/files/patch-18-syntax b/irc/rbot/files/patch-18-syntax
new file mode 100644
index 000000000000..03800704f683
--- /dev/null
+++ b/irc/rbot/files/patch-18-syntax
@@ -0,0 +1,123 @@
+--- rbot/ircbot.rb.orig Thu Mar 25 17:25:59 2004
++++ rbot/ircbot.rb Thu Mar 25 17:26:12 2004
+@@ -604,7 +604,7 @@
+ when (/^(version)|(introduce yourself)$/)
+ say m.replyto, "I'm a v. #{$version} rubybot, (c) Tom Gilbert - http://linuxbrit.co.uk/rbot/"
+ when (/^help(?:\s+(.*))?$/)
+- say m.replyto, help $1
++ say m.replyto, help($1)
+ when (/^(botsnack|ciggie)$/)
+ say m.replyto, @lang.get("thanks_X") % m.sourcenick if(m.public?)
+ say m.replyto, @lang.get("thanks") if(m.private?)
+--- rbot/dbhash.rb.orig Thu Mar 25 18:00:33 2004
++++ rbot/dbhash.rb Thu Mar 25 18:03:58 2004
+@@ -63,17 +63,17 @@
+
+ def DBHash.create_db(name)
+ debug "DBHash: creating empty db #{name}"
+- return BDB::Hash.open name, nil,
++ return BDB::Hash.open(name, nil,
+ BDB::CREATE | BDB::EXCL | BDB::TRUNCATE,
+ 0600, "set_pagesize" => 1024,
+- "set_cachesize" => [0, 32 * 1024, 0]
++ "set_cachesize" => [0, 32 * 1024, 0])
+ end
+
+ def DBHash.open_db(name)
+ debug "DBHash: opening existing db #{name}"
+- return BDB::Hash.open name, nil,
++ return BDB::Hash.open(name, nil,
+ "r+", 0600, "set_pagesize" => 1024,
+- "set_cachesize" => [0, 32 * 1024, 0]
++ "set_cachesize" => [0, 32 * 1024, 0])
+ end
+
+ end
+@@ -108,17 +108,17 @@
+
+ def DBTree.create_db(name)
+ debug "DBTree: creating empty db #{name}"
+- return BDB::CIBtree.open name, nil,
++ return BDB::CIBtree.open(name, nil,
+ BDB::CREATE | BDB::EXCL | BDB::TRUNCATE,
+ 0600, "set_pagesize" => 1024,
+- "set_cachesize" => [0, 32 * 1024, 0]
++ "set_cachesize" => [0, 32 * 1024, 0])
+ end
+
+ def DBTree.open_db(name)
+ debug "DBTree: opening existing db #{name}"
+- return BDB::CIBtree.open name, nil,
++ return BDB::CIBtree.open(name, nil,
+ "r+", 0600, "set_pagesize" => 1024,
+- "set_cachesize" => [0, 32 * 1024, 0]
++ "set_cachesize" => [0, 32 * 1024, 0])
+ end
+
+ end
+--- rbot/keywords.rb.orig Thu Mar 25 17:56:45 2004
++++ rbot/keywords.rb Thu Mar 25 17:59:31 2004
+@@ -22,7 +22,7 @@
+ # pick a random value for this keyword and return it
+ def to_s
+ if(@values.length > 1)
+- Keyword.unescape @values[rand @values.length]
++ Keyword.unescape @values[rand(@values.length)]
+ else
+ Keyword.unescape @values[0]
+ end
+--- rbot/language.rb.orig Thu Mar 25 17:59:39 2004
++++ rbot/language.rb Thu Mar 25 18:00:05 2004
+@@ -34,7 +34,7 @@
+
+ def get(key)
+ if(@strings.has_key?(key))
+- return @strings[key][rand @strings[key].length]
++ return @strings[key][rand(@strings[key].length)]
+ else
+ raise "undefined language key"
+ end
+--- rbot/plugins.rb.orig Thu Mar 25 18:07:07 2004
++++ rbot/plugins.rb Thu Mar 25 18:08:05 2004
+@@ -48,7 +48,7 @@
+ def initialize
+ @bot = Plugins.bot
+ @names = Array.new
+- @registry = BotRegistryAccessor.new(@bot, self.type.to_s.gsub(/^.*::/, ""))
++ @registry = BotRegistryAccessor.new(@bot, self.class.to_s.gsub(/^.*::/, ""))
+ end
+
+ # return an identifier for this plugin, defaults to a list of the message
+--- rbot/registry.rb.orig Thu Mar 25 18:04:02 2004
++++ rbot/registry.rb Thu Mar 25 18:04:16 2004
+@@ -149,7 +149,7 @@
+ if @registry.has_key?(@prefix + key)
+ return restore(@registry[@prefix + key])
+ elsif @default != nil
+- return restore @default
++ return restore(@default)
+ else
+ return nil
+ end
+--- rbot/utils.rb.orig Fri Mar 26 17:30:31 2004
++++ rbot/utils.rb Fri Mar 26 17:31:09 2004
+@@ -168,7 +168,7 @@
+
+ http.start {|http|
+ begin
+- resp , = http.get(query)
++ resp = http.get(query)
+ if resp.code == "200"
+ return resp.body
+ end
+--- rbot/plugins/google.rb.orig Fri Mar 26 17:31:42 2004
++++ rbot/plugins/google.rb Fri Mar 26 17:31:53 2004
+@@ -32,7 +32,7 @@
+
+ http.start {|http|
+ begin
+- resp , = http.get(query)
++ resp = http.get(query)
+ if resp.code == "302"
+ result = resp['location']
+ end
diff --git a/irc/rbot/files/patch-dice-roll b/irc/rbot/files/patch-dice-roll
new file mode 100644
index 000000000000..10a9a1deafc0
--- /dev/null
+++ b/irc/rbot/files/patch-dice-roll
@@ -0,0 +1,18 @@
+--- rbot/plugins/dice.rb.orig Thu Mar 25 17:33:36 2004
++++ rbot/plugins/dice.rb Mon Aug 5 14:58:04 2002
+@@ -30,7 +30,7 @@
+
+ class DicePlugin < Plugin
+ def help(plugin, topic="")
+- "dice <string> (where <string> is something like: d6 or 2d6 or 2d6+4 or 2d6+1d20 or 2d6+1d5+4d7-3d4-6) => Rolls that set of virtual dice"
++ "#{plugin} <string> (where <string> is something like: d6 or 2d6 or 2d6+4 or 2d6+1d20 or 2d6+1d5+4d7-3d4-6) => Rolls that set of virtual dice"
+ end
+
+ def rolldice(d)
+@@ -77,5 +77,6 @@
+ end
+ plugin = DicePlugin.new
+ plugin.register("dice")
++plugin.register("roll")
+ ##############################################
+ #fin
diff --git a/irc/rbot/files/patch-karma b/irc/rbot/files/patch-karma
new file mode 100644
index 000000000000..29690392db9d
--- /dev/null
+++ b/irc/rbot/files/patch-karma
@@ -0,0 +1,14 @@
+--- rbot/plugins/karma.rb.orig Thu Mar 25 18:09:37 2004
++++ rbot/plugins/karma.rb Thu Mar 25 18:11:01 2004
+@@ -34,9 +34,9 @@
+ if(m.kind_of?(PrivMessage) && m.public?)
+ # in channel message, the kind we are interested in
+ if(m.message =~ /(\+\+|--)/)
+- string = m.message.sub(/\W(--|\+\+)(\(.*?\)|[^(++)(--)\s]+)/, "\2\1")
++ string = m.message.sub(/\W(--|\+\+)(\(.*?\)|[^-+\s]+)/, "\2\1")
+ seen = Hash.new
+- while(string.sub!(/(\(.*?\)|[^(++)(--)\s]+)(\+\+|--)/, ""))
++ while(string.sub!(/(\(.*?\)|[^-+\s]+)(\+\+|--)/, ""))
+ key = $1
+ change = $2
+ next if seen[key]
diff --git a/irc/rbot/files/patch-lart-suth b/irc/rbot/files/patch-lart-suth
new file mode 100644
index 000000000000..27c61016d807
--- /dev/null
+++ b/irc/rbot/files/patch-lart-suth
@@ -0,0 +1,18 @@
+--- rbot/plugins/lart.rb.orig Thu Mar 25 17:33:36 2004
++++ rbot/plugins/lart.rb Wed Aug 7 12:59:24 2002
+@@ -21,6 +21,7 @@
+ # Keep a 1:1 relation between commands and handlers
+ @@handlers = {
+ "lart" => "handle_lart",
++ "suth" => "handle_lart",
+ "praise" => "handle_praise",
+ "addlart" => "handle_addlart",
+ "rmlart" => "handle_rmlart",
+@@ -152,6 +153,7 @@
+ end
+ plugin = LartPlugin.new
+ plugin.register("lart")
++plugin.register("suth")
+ plugin.register("praise")
+
+ plugin.register("addlart")
diff --git a/irc/rbot/files/patch-math b/irc/rbot/files/patch-math
new file mode 100644
index 000000000000..87dd66063e2c
--- /dev/null
+++ b/irc/rbot/files/patch-math
@@ -0,0 +1,28 @@
+--- rbot/plugins/math.rb.orig Thu Mar 25 17:33:36 2004
++++ rbot/plugins/math.rb Mon Jan 27 11:52:37 2003
+@@ -77,13 +77,13 @@
+ expr.gsub!(/\bover /, "/ ")
+ expr.gsub!(/\bsquared/, "**2 ")
+ expr.gsub!(/\bcubed/, "**3 ")
+- expr.gsub!(/\bto\s+(\d+)(r?st|nd|rd|th)?( power)?/, "**#$1 ")
++ expr.gsub!(/\bto\s+(\d+)(r?st|nd|rd|th)?( power)?/, '**\1 ')
+ expr.gsub!(/\bpercent of/, "*0.01*")
+ expr.gsub!(/\bpercent/, "*0.01")
+ expr.gsub!(/\% of\b/, "*0.01*")
+ expr.gsub!(/\%/, "*0.01")
+- expr.gsub!(/\bsquare root of (\d+)/, "#$1 ** 0.5 ")
+- expr.gsub!(/\bcubed? root of (\d+)/, "#$1 **(1.0/3.0) ")
++ expr.gsub!(/\bsquare root of (\d+)/, '\1 ** 0.5 ')
++ expr.gsub!(/\bcubed? root of (\d+)/, '\1 **(1.0/3.0) ')
+ expr.gsub!(/ of /, " * ")
+ expr.gsub!(/(bit(-| )?)?xor(\'?e?d( with))?/, "^")
+ expr.gsub!(/(bit(-| )?)?or(\'?e?d( with))?/, "|")
+@@ -101,7 +101,7 @@
+ if answer =~ /^[-+\de\.]+$/
+ answer = sprintf("%1.12f", answer)
+ answer.gsub!(/\.?0+$/, "")
+- answer.gsub!(/(\.\d+)000\d+/, $1)
++ answer.gsub!(/(\.\d+)000\d+/, '\1')
+ if (answer.length > 30)
+ answer = "a number with >30 digits..."
+ end
diff --git a/irc/rbot/files/patch-url b/irc/rbot/files/patch-url
new file mode 100644
index 000000000000..af080e725ea6
--- /dev/null
+++ b/irc/rbot/files/patch-url
@@ -0,0 +1,11 @@
+--- rbot/plugins/url.rb.orig Thu Mar 25 17:33:36 2004
++++ rbot/plugins/url.rb Wed Aug 21 11:58:41 2002
+@@ -42,7 +42,7 @@
+ else
+ m.reply "in a private message, you need to specify a channel name for urls"
+ end
+- when (/^(#.*?)\s+\d+$/)
++ when (/^(#.*?)\s+(\d+)$/)
+ channel = $1
+ max = $2.to_i
+ urls m, channel, max
diff --git a/irc/rbot/pkg-descr b/irc/rbot/pkg-descr
index b6a20bd3a44b..8a15665418a1 100644
--- a/irc/rbot/pkg-descr
+++ b/irc/rbot/pkg-descr
@@ -6,26 +6,7 @@ features, and a nicer plugin scheme. His main features include:
* Built in infobot-style keywords. See example session below.
* Support for underlying fact database (infobot fact files), which can be
overridden or supplemented by runtime keyword controls
- * Powerful plugin architecture, comes with plugins for:
- o DNS queries
- o Babelfish translation
- o Google searching
- o Excuse generation
- o Insult generation
- o Karma
- o Checking the weather
- o Querying slashdot
- o Doing Math
- o Per-channel quote storage, searching and retrieval
- o Reminders
- o rot13 translation
- o Check the spelling of a word
- o Webserver Server: header examination
- o RPG dice rolling (thanks to David Dorward)
- o Slapping people :)
- o larting people
- o conversation stats
- o more...
+ * Powerful plugin architecture, comes with plugins for many functions.
* Multi-language support - comes with english definition only so far -
translations welcome
diff --git a/irc/rbot/pkg-message b/irc/rbot/pkg-message
new file mode 100644
index 000000000000..31486ca94a17
--- /dev/null
+++ b/irc/rbot/pkg-message
@@ -0,0 +1,4 @@
+NOTE! If you are upgrading from Ruby 1.6.x to 1.8.x, the Marshal serialization
+format has changed, and your plugin_registry.db will BREAK! I fixed this by
+compiling marshal.c from the Ruby 1.6 distribution into a module for Ruby 1.8,
+then writing a converter. YMMV.
diff --git a/irc/rbot/pkg-plist b/irc/rbot/pkg-plist
index 94243e574f1b..d1fe4a977876 100644
--- a/irc/rbot/pkg-plist
+++ b/irc/rbot/pkg-plist
@@ -47,7 +47,6 @@ bin/rbot
%%RUBY_SITELIBDIR%%/rbot/plugins/freshmeat.rb
%%RUBY_SITELIBDIR%%/rbot/plugins/roulette.rb
%%RUBY_SITELIBDIR%%/rbot/dbhash.rb
-%%RUBY_SITELIBDIR%%/rbot/keywords.rb.orig
@dirrm %%RUBY_SITELIBDIR%%/rbot/languages
@dirrm %%RUBY_SITELIBDIR%%/rbot/dbplugins
@dirrm %%RUBY_SITELIBDIR%%/rbot/plugins