Module: Ext::Og

Extended by:
Equipment
Defined in:
lib/ext/og.rb

Overview

Add some facilities for using Og in Camping. Stores the manager outside of the app so that you can reload it without sideeffects.

BUGS

The Camping::Reloader messes up that extension and creates a new OGTABLE table. This is because of how Og works. Needs to be changed.

In other news, Og is really buggs so this module will not be developped further.

TODO

  • Fix Og

  • Maybe change table names

  • Maybe add E as Entity in Models

Defined Under Namespace

Modules: CClassMethods, ModelsClassMethods, Views

Constant Summary

Constants included from Equipment

Equipment::DATA_PATH, Equipment::LIB_PATH

Instance Attribute Summary

Attributes included from Equipment

#debug

Class Method Summary collapse

Methods included from Equipment

dependencies, depends_on, equip, equip_all, global_extensions, included

Class Method Details

.managersObject



100
101
102
# File 'lib/ext/og.rb', line 100

def managers
  @managers ||= {}
end

.setup(app) ⇒ Object

Returns a manager for you app.



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/ext/og.rb', line 80

def setup(app)

  ::Og.raise_store_exceptions = $DBG if $DBG
  ::Og.thread_safe = false
  unless manager = managers[app.name]
    manager = ::Og::Manager.new(app::Models.og || {})
    managers[app.name] = manager
  end

  manager.unmanage_classes # needed ?

  classes = app::Models.constants.reject{|c|c=='Base'}.map{|c|app::Models.const_get(c)}

  p "Manageable classes: " + classes.inspect if $DBG

  manager.manage_classes classes #unless classes.empty?

  manager
end