0
+# Configuration generator for irccat
0
+# Created on 2008-2-17.
0
+# Copyright (c) 2008. All rights reserved.
0
+require 'highline/import'
0
+ puts "== IRC Configuration"
0
+ config['irc'] = Hash.new
0
+ config['irc']['host'] = ask("Hostname: ") { |q| q.default = "irc.freenode.net" }
0
+ config['irc']['port'] = ask("Port: ") { |q| q.default = "6667" }
0
+ config['irc']['nick'] = ask("Nickname: ") { |q| q.default = "irc_cat" }
0
+ config['irc']['channel'] = ask("Channel: ") { |q| q.default = "#irc_cat" }
0
+ puts "\n== HTTP Configuration"
0
+ config['http'] = Hash.new
0
+ if agree("Enable HTTP? ", true); config['http']['enabled'] = true; else; config['http']['enabled'] = false; end
0
+ if config['http']['enabled']
0
+ config['http']['host'] = ask("Hostname: ") { |q| q.default = "0.0.0.0" }
0
+ config['http']['port'] = ask("Port: ") { |q| q.default = "3489" }
0
+ if agree("Enable Basic HTTP send? ", true); config['http']['send'] = true; else; config['http']['send'] = false; end
0
+ if agree("Enable Github? ", true); config['http']['github'] = true; else; config['http']['github'] = false; end
0
+ puts "\n== TCP Configuration"
0
+ config['tcp'] = Hash.new
0
+ if agree("Enable TCP? ", true); config['tcp']['enabled'] = true; else; config['tcp']['enabled'] = false; end
0
+ if config['tcp']['enabled']
0
+ config['tcp']['host'] = ask("Hostname: ") { |q| q.default = "0.0.0.0" }
0
+ config['tcp']['port'] = ask("Port: ") { |q| q.default = "5678" }
0
+ config['tcp']['size'] = ask("Socket size: ") { |q| q.default = "400" }
0
+ puts "\n== Final steps"
0
+ file = ask("Configuration filename: ") { |q| q.default = "config.yml" }
0
+ puts "Warning: File exists! If you choose yes now the file will be overwritted" if File.exists?(File.expand_path(file))
0
+ if agree("Write configuration file? ", true)
0
+ File.open(File.expand_path(file), "w") { |yfile| YAML.dump(config, yfile) }
0
+ puts "irccat-config - configuration generator for irccat\n"
0
+ puts "Usage: #{File.basename($0)} irccat|client > configfile.yml"
Comments
No one has commented yet.