ThinTestSlice
=============

A thin slice for the Merb framework.

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

thin-test-slice
|-- LICENSE
|-- README
|-- Rakefile [1]
|-- TODO
|-- application.rb [2]
|-- lib
|   |-- thin-test-slice
|   |   |-- merbtasks.rb [3]
|   |   `-- slicetasks.rb [4]
|   `-- thin-test-slice.rb [5]
|-- public [6]
|   |-- javascripts
|   |   `-- master.js
|   `-- stylesheets
|       `-- master.css
|-- stubs [7]
|   `-- application.rb
`-- views [8]
    |-- layout
    |   `-- thin-test-slice.html.erb [9]
    `-- main
        `-- index.html.erb


1. Rake tasks to package/install the gem - edit this to modify the manifest.
2. The slice application in a single file: controllers, models, helper methods.
3. Standard rake tasks available to your application.
4. Your custom application rake tasks.
5. The main slice file - contains all slice setup logic/config.
6. Public assets you (optionally) install using rake slices:my_slice:install
7. Stubs of classes/views/files for the end-user to override - usually these 
   mimic the files in app/ and/or public/; use rake slices:thin-test-slice:stubs to
   get started with the override stubs. Also, slices:thin-test-slice:patch will
   copy over views to override in addition to the files found in /stubs.
8. A thin slice stores its views seperately.
9. The default layout, as specified in Merb::Slices::config[:my_slice][:layout]
   change this to :application to use the app's layout.
   
   
To see all available tasks for ThinTestSlice run:

rake -T slices:thin-test-slice

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

Instructions for installation:

file: config/init.rb

# add the slice as a regular dependency

dependency 'thin-test-slice'

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

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

# optionally configure the plugins in a before_app_loads callback

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

file: config/router.rb

# example: /thin-test-slice/:controller/:action/:id

add_slice(:ThinTestSlice)

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

add_slice(:ThinTestSlice, 'foo') # same as :path => 'foo'

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

add_slice(:ThinTestSlice, :path => ':lang')

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

slice(:ThinTestSlice)

Normally you should also run the following rake task:

rake slices:thin_test_slice:install

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

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>