0.0
No commit activity in last 3 years
No release in over 3 years
Configuration DSL for configuring CanTango
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.1.rc
>= 1.6.4
>= 0
>= 2.6.0

Runtime

~> 1.2
>= 3.1
>= 0.6.1
~> 0.1.6
 Project Readme

Cantango Configuration

Configuration for CanTango.

Status: Aug 2012

The Configuration DSL has now been almost fully "spec'ed".

169 examples, 12 failures, 4 pending

Please help fix the remaining specs ;)

Dependencies

This extension depends on the CanTango core and follows the extension conventions as described there.

Core extensions

  • YAML Loader - use of Config to set where (which folder) to load the YAML file from

Configuration

Configuration allows configuration of the following components:

  • Ability
  • Account
  • Accounts
  • Adapters
  • Categories
  • Debug
  • Engines
  • Guest
  • Hooks
  • Localhosts
  • Models
  • Modes
  • Orms
  • User
  • Users

Example:

CanTango.config.accounts do |accounts|
  # configure accounts
end

Ability

  • modes
  • default_executor_class
  • default_executor_class= clazz
  • default_class # CanTango::Ability::Base
  • factory_class_method # :default_executor_class

Modes

Is a type of Registry::Clazz

CanTango.config.ability do |ability|
  ability.modes.register 
end

Also has an Execution object

ability.modes.execution

  • available # [:cache, :no_cache]
  • default # [:no_cache]

Account

  • clear!
  • base_class
  • base_class= clazz

Accounts

  • register_account clazz

Adapters

  • adapter name # load an adapter!
  • use *names # use one or more adapters
  • available # list adapters available

AutoLoad

auto-load models and/or permits

TODO: Refactor! Mofe all permits functionality to cantango-permits!

Categories

  • [] label
  • category label, &block
  • has_any? subject, &block
  • category_names_of_subject subject, &block
  • categories_of_subject subject, &block

Debug

Engines

  • Available
  • Order

Available

  • available
  • available? name
  • all state # - all engines in states :on or :off
  • any? state # any engine in state :on or :off ?

Order

  • clear_order!
  • set_execution_order *names
  • dont_execute name
  • execute_first name
  • execute_last name
  • execute_before existing, name
  • execute_after existing, name
  • execution_order

Factory

Guest

  • clear!
  • user user = nil, &block
  • account acc = nil, &block
  • default_user?
  • default_account?

Helpers

  • enable *names
  • enable_rest # enable REST

Hooks

Kind of Hash Registry

  • value_methods

LocalHosts

Kind of Base Registry

  • default # 'localhost', '127.0.0.1'

Models

  • use *names
  • actions
  • by_reg_exp reg_exp
  • by_category label
  • exclude *names
  • excluded
  • available

Actions

Adapters:

  • ActiveRecord
  • DataMapper
  • Generic
  • Mongo
  • MongoMapper
  • Mongoid

Actions

  • actions_for type
  • add_member action
  • add_collection action

Models

  • available_models

OnOff

include on/off functionality

  • on!
  • off!
  • on?
  • off?

Orms

Kind of Base Registry

User

  • clear!
  • base_class
  • base_class= clazz
  • unique_key_field
  • unique_key_field= key
  • relations= *relations
  • relations
  • default_relations # [:owner, :author, :writer, :user]

Users

Kind of Clazz registry

  • register_user clazz

Registry

The Registry namespace contains registries useful for configuration and other purposes.

  • CanTango::Registry
    • Base
    • Hash
    • Clazz

CanTango::Registry::Base

  • types= *classes
  • types
  • clean! or clear!
  • reset!
  • register list or << list
  • [] index
  • registered
  • registered? label
  • valid? label
  • available

CanTango::Registry::Clazz

Inherits from Base

  • #register cache: Caching
  • << {cache: Caching, no_cache: NoCache}
  • registered
  • clean!
  • registered_classes
  • registered? name
  • registered_class? name
  • name_registry
  • class_registry
  • value_methods
  • value_types

CanTango::Registry::Hash

Inherits from Base

  • registered_names
  • registered_values

Contributing to cantango-config

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
  • Fork the project
  • Start a feature/bugfix branch
  • Commit and push until you are happy with your contribution
  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright

Copyright (c) 2011 Kristian Mandrup. See LICENSE.txt for further details.