Top Level Namespace

Defined Under Namespace

Modules: JsChat, JsClient, Ncurses, Sinatra

Constant Summary collapse

ClientConfig =
{
  :port => options['port'] || '6789',
  :ip => options['hostname'] || '0.0.0.0',
  :name => options['nick'] || ENV['LOGNAME'],
  :auto_join => options['room'] || '#jschat'
}
ServerConfigDefaults =
{
  'port' => 6789,
  'ip' => '0.0.0.0',
  'logger' => logger,
  'max_message_length' => 500,
  'tmp_files' => File.join(Dir::tmpdir, 'jschat'),
  'db_name' => 'jschat',
  'db_host' => 'localhost',
  'db_port' => 27017,
  #'db_username' => '',
  #'db_password' => '',
  # Register your instance of JsChat here: http://twitter.com/apps/create
  # 'twitter' => { 'key' => '', 'secret' => '' }
}
ServerConfig =
ServerConfigDefaults.merge options

Instance Method Summary collapse

Instance Method Details

#load_options(path) ⇒ Object

Command line options will overrides these



28
29
30
31
32
33
34
35
# File 'lib/jschat/client.rb', line 28

def load_options(path)
  path = File.expand_path path
  if File.exists? path
    JSON.parse(File.read path)
  else
    {}
  end
end

#make_tmp_filesObject



36
37
38
39
40
41
42
43
44
45
# File 'lib/jschat/server_options.rb', line 36

def make_tmp_files
  ServerConfig['use_tmp_files'] = false
  if File.exists? ServerConfig['tmp_files']
    ServerConfig['use_tmp_files'] = true
  else
    if Dir.mkdir ServerConfig['tmp_files']
      ServerConfig['use_tmp_files'] = true
    end
  end
end