Class Irc::Bot::Config::Wizard
In: lib/rbot/config.rb
Parent: Object
BasicUserMessage JoinMessage NamesMessage WhoisMessage ModeChangeMessage KickMessage MotdMessage QuitMessage BanlistMessage UserMessage NoSuchTargetMessage TopicMessage NickMessage WelcomeMessage UnknownMessage InviteMessage PartMessage NetmaskList UserList ArrayOf ChannelList Netmask User\n[lib/rbot/botuser.rb\nlib/rbot/irc.rb] Channel Singleton RfcCasemap StrictRfcCasemap AsciiCasemap Casemap PrivMessage NoticeMessage TokyoCabinet::BDB CIBDB Btree CIBtree Socket MessageQueue QueueRing Client DBHash\n[lib/rbot/registry/bdb.rb\nlib/rbot/registry/tc.rb] DBTree\n[lib/rbot/registry/bdb.rb\nlib/rbot/registry/tc.rb] Server NetmaskDb Bot\n[lib/rbot/botuser.rb\nlib/rbot/config.rb\nlib/rbot/ircbot.rb\nlib/rbot/language.rb\nlib/rbot/message.rb\nlib/rbot/messagemapper.rb\nlib/rbot/plugins.rb\nlib/rbot/rbotconfig.rb\nlib/rbot/registry/bdb.rb\nlib/rbot/registry/tc.rb] lib/rbot/ircsocket.rb lib/rbot/rfc2812.rb lib/rbot/registry/tc.rb lib/rbot/irc.rb lib/rbot/maskdb.rb lib/rbot/message.rb lib/rbot/messagemapper.rb lib/rbot/botuser.rb lib/rbot/registry/tc.rb (null) BotConfig PKGConfig ServerOrCasemap Irc dot/m_35_0.png

Methods

new   run  

Public Class methods

[Source]

     # File lib/rbot/config.rb, line 364
364:     def initialize(bot)
365:       @bot = bot
366:       @manager = Config.manager
367:       @questions = @manager.items.values.find_all {|i| i.wizard }
368:     end

Public Instance methods

[Source]

     # File lib/rbot/config.rb, line 370
370:     def run()
371:       $stdout.sync = true
372:       puts _("First time rbot configuration wizard")
373:       puts "===================================="
374:       puts _("This is the first time you have run rbot with a config directory of: #{@bot.botclass}")
375:       puts _("This wizard will ask you a few questions to get you started.")
376:       puts _("The rest of rbot's configuration can be manipulated via IRC once rbot is connected and you are auth'd.")
377:       puts "-----------------------------------"
378: 
379:       return unless @questions
380:       @questions.sort{|a,b| a.order <=> b.order }.each do |q|
381:         puts _(q.desc)
382:         begin
383:           print q.key.to_s + " [#{q.to_s}]: "
384:           response = STDIN.gets
385:           response.chop!
386:           unless response.empty?
387:             q.set_string response, false
388:           end
389:           puts _("configured #{q.key} => #{q.to_s}")
390:           puts "-----------------------------------"
391:         rescue ArgumentError => e
392:           puts _("failed to set #{q.key}: #{e.message}")
393:           retry
394:         end
395:       end
396:     end

[Validate]