Sha256: b3b8aa7eeb63b15adbd0787045edc7cd334e628dc39a5ac67ae9b2311a3cd1b7

Contents?: true

Size: 1.94 KB

Versions: 1

Compression:

Stored size: 1.94 KB

Contents

$:.unshift(File.dirname(__FILE__)) unless
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))

require 'eventmachine'
require 'log4r'
require 'nokogiri'
require 'yaml'
require 'fileutils'

require 'babylon/xmpp_connection'
require 'babylon/xmpp_parser'
require 'babylon/component_connection'
require 'babylon/client_connection'
require 'babylon/router'
require 'babylon/runner'
require "babylon/xpath_helper"
require 'babylon/base/controller'
require 'babylon/base/view'

# Babylon is a XMPP Component Framework based on EventMachine. It uses the Nokogiri GEM, which is a Ruby wrapper for Libxml2.
# It implements the MVC paradigm.
# You can create your own application by running :
#   $> babylon app_name
# This will generate some folders and files for your application. Please see README for further instructions

module Babylon

  def self.environment=(_env)
    @@env = _env
  end

  def self.environment
    unless self.class_variable_defined?("@@env")
      @@env = "development"
    end
    @@env
  end
  
  ##
  # Caches the view files to improve performance.  
  def self.cache_views
    @@cached_views= {}
    Dir.glob('app/views/*/*').each do |f|
      @@cached_views[f] = File.read(f)
    end        
  end
  
  def self.cached_views
    unless self.class_variable_defined?("@@cached_views")
      @@cached_views= {}
    end
    @@cached_views
  end

  ##
  # Returns a shared logger for this component.
  def self.logger
    unless self.class_variable_defined?("@@logger")
      @@logger = Log4r::Logger.new("BABYLON")
      @@logger.add(Log4r::Outputter.stderr)
    end
    @@logger
  end

  ##
  # Set the configuration for this component.
  def self.config=(conf)
    @@config = conf
  end

  ##
  # Return the configuration for this component.
  def self.config
    @@config
  end

  ##
  # Authentication Error (wrong password/jid combination). Used for Clients and Components
  class AuthenticationError < Exception 
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
julien51-babylon-0.0.9 lib/babylon.rb