public
Description: Merb Slice for application security/authentication
Clone URL: git://github.com/technomage/secure-magic.git
name age message
file LICENSE Sun Jun 08 16:46:21 -0700 2008 More inital files [technomage]
file README Sun Jun 08 16:45:24 -0700 2008 Initial version of code - non-functional [technomage]
file Rakefile Sun Jun 08 16:46:21 -0700 2008 More inital files [technomage]
file TODO Sun Jun 08 16:46:21 -0700 2008 More inital files [technomage]
directory app/ Mon Jun 09 21:25:09 -0700 2008 Updates [technomage]
directory lib/ Mon Jun 09 21:25:09 -0700 2008 Updates [technomage]
directory pkg/ Mon Jun 09 21:25:09 -0700 2008 Updates [technomage]
directory public/ Sun Jun 08 16:46:21 -0700 2008 More inital files [technomage]
directory spec/ Sun Jun 08 16:46:21 -0700 2008 More inital files [technomage]
directory stubs/ Sun Jun 08 16:46:21 -0700 2008 More inital files [technomage]
README
SecureMagic
===========

A slice for the Merb framework. 

------------------------------------------------------------------------------

Instructions for installation:

file: config/init.rb

# add the slice as a regular dependency

dependency 'secure-magic'

# if needed, configure which slices to load and in which order

Merb::Plugins.config[:merb_slices] = { :queue => ["SecureMagic", ...] }

# optionally configure the plugins in a before_app_loads callback

Merb::BootLoader.before_app_loads do
  
  Merb::Slices::config[:secure_magic][:option] = value
  
end

file: config/router.rb

# example: /secure-magic/:controller/:action/:id

r.add_slice(:SecureMagic)

# example: /foo/:controller/:action/:id

r.add_slice(:SecureMagic, 'foo') # same as :path => 'foo'

# example: /:lang/:controller/:action/:id (with :a param set)

r.add_slice(:SecureMagic, :path => ':lang', :params => { :a => 'b' })

# example: /:controller/:action/:id

r.slice(:SecureMagic)

Normally you should also run the following rake task:

rake slices:secure_magic:install

------------------------------------------------------------------------------

You can put your application-level overrides in:

host-app/slices/secure-magic/app - controllers, models, views ...

Templates are located in this order:

1. host-app/slices/secure-magic/app/views/*
2. gems/secure-magic/app/views/*
3. host-app/app/views/*

You can use the host application's layout by configuring the
secure-magic slice in a before_app_loads block:

Merb::Slices.config[:secure_magic] = { :layout => :application }

By default :secure_magic is used. If you need to override
stylesheets or javascripts, just specify your own files in your layout
instead/in addition to the ones supplied (if any) in 
host-app/public/slices/secure-magic.

In any case don't edit those files directly as they may be clobbered any time
rake secure_magic:install is run.

------------------------------------------------------------------------------

About Slices
============

Merb-Slices is a Merb plugin for using and creating application 'slices' which
help you modularize your application. Usually these are reuseable extractions
from your main app. In effect, a Slice is just like a regular Merb MVC
application, both in functionality as well as in structure.

When you generate a Slice stub structure, a module is setup to serve as a
namespace for your controller, models, helpers etc. This ensures maximum
encapsulation. You could say a Slice is a mixture between a Merb plugin (a
Gem) and a Merb application, reaping the benefits of both.

A host application can 'mount' a Slice inside the router, which means you have
full over control how it integrates. By default a Slice's routes are prefixed
by its name (a router :namespace), but you can easily provide your own prefix
or leave it out, mounting it at the root of your url-schema. You can even
mount a Slice multiple times and give extra parameters to customize an
instance's behaviour.

A Slice's Application controller uses controller_for_slice to setup slice
specific behaviour, which mainly affects cascaded view handling. Additionaly,
this method is available to any kind of controller, so it can be used for
Merb Mailer too for example.

There are many ways which let you customize a Slice's functionality and
appearance without ever touching the Gem-level code itself. It's not only easy
to add template/layout overrides, you can also add/modify controllers, models
and other runtime code from within the host application.

To create your own Slice run this (somewhere outside of your merb app):

$ merb-gen slice <your-lowercase-slice-name>