Module: Twke

Defined in:
lib/twke/conf.rb,
lib/twke.rb,
lib/twke/routes.rb

Overview

Simple configuration system.

Variable names are dot-separated, similar to how sysctl(8) names work.

For example, a ‘heroku’ module could prefix all variables with “heroku.”:

heroku.sites.metrics-prod.giturl
heroku.sites.metrics-prod.token

The conf system can also lookup all the sub-variables rooted at a single prefix. So for example, assume the following variables are also set:

 heroku.sites.metrics-stg.giturl
 heroku.sites.metrics-stg.token

A list command on 'heroku.sites' would return:
       ['metrics-prod', 'metrics-stg']

Defined Under Namespace

Modules: Conf, Routes

Class Method Summary collapse

Class Method Details

.plugin(plgn) ⇒ Object



14
15
16
# File 'lib/twke.rb', line 14

def self.plugin(plgn)
  puts "Registering plugin #{plgn.plugin_name}"
end

.shutdownObject



36
37
38
# File 'lib/twke.rb', line 36

def self.shutdown
  exit 0
end

.start(scamp) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/twke.rb', line 18

def self.start(scamp)
  Twke::Conf.load
  Twke::Routes.load(scamp)

  # XXX: Scamp needs an on_connect callback, fake one with a timer
  # here.
  # EM::Timer.new(5) do
  #   Twke::Routes.on_connect
  # end

  # Any rooms configured to join via the CLI will be done in the
  # on_connect CB.
  #
  scamp.connect!([]) do
    Twke::Routes.on_connect
  end
end

.versionObject



10
11
12
# File 'lib/twke.rb', line 10

def self.version
  File.read(File.join(File.dirname(__FILE__), '../VERSION')).chomp
end