lib/transit.rb in transit-0.0.1 vs lib/transit.rb in transit-0.0.2

- old
+ new

@@ -1,32 +1,62 @@ -require 'rails' require 'active_support' -require 'mongoid' +require 'transit/core_ext' module Transit - autoload :Package, 'transit/package' - autoload :Context, 'transit/context' + autoload :Admin, 'transit/admin' + autoload :Config, 'transit/config' - module Helpers - autoload :ControllerHelpers, 'transit/helpers/controller_helpers' - autoload :ModelHelpers, 'transit/helpers/model_helpers' + module Package + autoload :Post, 'transit/package/post' + autoload :Page, 'transit/package/page' end + module Model + autoload :Assets, 'transit/model/assets' + autoload :Attachments, 'transit/model/attachments' + autoload :AutoIncrement, 'transit/model/auto_increment' + autoload :Comments, 'transit/model/comments' + autoload :Topics, 'transit/model/topics' + autoload :Base, 'transit/model/base' + autoload :Hooks, 'transit/model/hooks' + autoload :Owners, 'transit/model/owners' + autoload :Paginator, 'transit/model/paginator' + end + + module Controller + autoload :Generator, 'transit/controller/generator' + autoload :Responder, 'transit/controller/responder' + end + module Errors - autoload :InvalidContext, 'transit/errors/invalid_context' + autoload :InvalidContext, 'transit/errors/invalid_context' + autoload :ResourceNotFound, 'transit/errors/resource_not_found' end + module Builders + autoload :JstBuilder, 'transit/builders/jst_builder' + autoload :FormBuilder, 'transit/builders/form_builder' + autoload :PackageBuilder, 'transit/builders/package_builder' + end + DESCRIPTIONS = {} - CONTROLLERS = [] - def self.add_controller(klass) - CONTROLLERS << klass.to_s.classify.pluralize + # Store an array of controller mappings + mattr_accessor :mappings + @@mappings = [] + + def self.add_mapping(obj) + @@mappings << obj end - + + def self.configure(&block) + yield Transit::Config + end + def self.contexts - Transit::Context.subclasses.map(&:to_s).uniq + ["Text","Video", "Audio"] end def self.track(klass, template) DESCRIPTIONS[template] ||= [] DESCRIPTIONS[template] |= [klass.to_s] @@ -34,10 +64,14 @@ def self.lookup(template) DESCRIPTIONS[template] ||= [] end + def self.superclass_for(template) + DESCRIPTIONS[template].detect do |klass| + klass.constantize.superclass === Object + end + end + end - -require 'transit/package' -require 'transit/rails/engine' -require 'transit/rails/routing' +require 'transit/model/hooks' +require 'transit/rails/engine' \ No newline at end of file