bin/botolo in botolo-0.50.1 vs bin/botolo in botolo-0.55.0

- old
+ new

@@ -1,24 +1,26 @@ #!/usr/bin/env ruby require 'botolo' require 'openssl' -require 'codesake-commons' +require 'logger' require 'getoptlong' opts = GetoptLong.new( [ "--debug", "-D", GetoptLong::NO_ARGUMENT], [ "--help", "-h", GetoptLong::NO_ARGUMENT], [ "--version", "-v", GetoptLong::NO_ARGUMENT ] ) DEFAULT_BEHAVIOUR = "./lib/botolo/bot/behaviour.rb" -BOTOLO_PID = File.join(".", "botolo.pid") +BOTOLO_PID = File.join(".", "botolo.pid") OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE -$logger = Codesake::Commons::Logging.instance +$logger = Logger.new(STDOUT) +$logger.datetime_format = '%Y-%m-%d %H:%M:%S' + trap("INT") { @bot.stop; $logger.bye; File.delete(BOTOLO_PID); Kernel.exit(0); } opts.quiet=true debug = false @@ -45,10 +47,10 @@ config_file = nil config_file = ARGV[0] if ARGV.count == 1 $logger.die "usage: botolo bot_configuration_file" if config_file.nil? -$logger.helo "botolo", Botolo::VERSION, BOTOLO_PID +$logger.helo "botolo", Botolo::VERSION @bot = Botolo::Bot::Engine.new({:config=>config_file}) $logger.log "#{@bot.name} is online" if @bot.online? $logger.log "#{@bot.name} is offline" unless @bot.online?