module Twke

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']

Public Class Methods

plugin(plgn) click to toggle source
# File lib/twke.rb, line 14
def self.plugin(plgn)
  puts "Registering plugin #{plgn.plugin_name}"
end
shutdown() click to toggle source
# File lib/twke.rb, line 36
def self.shutdown
  exit 0
end
start(scamp) click to toggle source
# 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
version() click to toggle source
# File lib/twke.rb, line 10
def self.version
  File.read(File.join(File.dirname(__FILE__), '../VERSION')).chomp
end