]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - bin/rbot
nope, that breaks gem install, need a better way
[user/henk/code/ruby/rbot.git] / bin / rbot
index f65cb949875b0270663f59a11b6ef7ca2a3a26b0..442617892ba1874a262c62fbd2d1c53b6989fb20 100755 (executable)
--- a/bin/rbot
+++ b/bin/rbot
@@ -26,24 +26,11 @@ $VERBOSE=true
 require 'etc'
 require 'getoptlong'
 require 'fileutils'
-require 'rbconfig'
 
-begin
-  require 'rbot/ircbot'
-rescue LoadError => e
-  puts "Error: couldn't find the rbot/ircbot module for loading\n - did you install rbot using install.rb?"
-  exit 2
-end
-  
-$debug = false
-$version="0.9.8"
+$version="0.9.9"
 $opts = Hash.new
 
-# print +message+ if debugging is enabled
-def debug(message=nil)
-  print "DEBUG: #{message}\n" if($debug && message)
-  #yield
-end
+orig_opts = ARGV.dup
 
 opts = GetoptLong.new(
   ["--debug", "-d", GetoptLong::NO_ARGUMENT],
@@ -52,6 +39,7 @@ opts = GetoptLong.new(
   ["--version", "-v", GetoptLong::NO_ARGUMENT]
 )
 
+$debug = false
 opts.each {|opt, arg|
   $debug = true if(opt == "--debug")
   $opts[opt.sub(/^-+/, "")] = arg
@@ -65,6 +53,12 @@ if ($opts["trace"])
   }
 end
 
+begin
+  require 'rbot/ircbot'
+rescue LoadError => e
+  puts "Error: couldn't find the rbot/ircbot module for loading\n - did you install rbot using setup.rb?"
+  exit 2
+end
 
 if ($opts["version"])
   puts "rbot #{$version}"
@@ -80,7 +74,7 @@ if ($opts["help"])
   exit 0
 end
 
-if(bot = Irc::IrcBot.new(ARGV.shift))
+if(bot = Irc::IrcBot.new(ARGV.shift, :argv => orig_opts))
   # just run the bot
   bot.mainloop
 end