Code Monkey home page Code Monkey logo

cantango-config's Introduction

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.

cantango-config's People

Contributors

kristianmandrup avatar stanislaw avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

mwean

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.