Multi-App Support / Edits
Edited line 1 :
Multi-app functionality is now officially supported in Merb using Slices.
Multi-app functionality is now officially supported in Merb using merb-slices – from the README:
Merb-slices
Merb-Slices is a Merb plugin which forms the basis 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 inherits from Merb::Slices::Controller, which in turn inherits from Merb::Controller. This isn’t strictly necessary to work, but it gives you specific view-handling functionality.
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
Edited line 49 :
Edited line 41 :
$ merb-gen slice your-lowercase-slice-name
$ merb-gen slice
Edited line 1 :
Multi-app functionality is now officially supported in Merb using merb-slices – from the README:
Multi-app functionality is not (yet?) officially supported in Merb. However, there is definitely interest in exploring possibilities to facilitate the feature.
Edited line 3 :
Merb-slices
Merb-Slices is a Merb plugin which forms the basis 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 inherits from Merb::Slices::Controller, which in turn inherits from Merb::Controller. This isn’t strictly necessary to work, but it gives you specific view-handling functionality.
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
It follows the concepts discussed in the post below quite closely.
Edited line 5 :
Edited line 9 :
Expect to find more info here as we uncover Merb’s multi-app capacity.
Edited line 6 :
Edited line 1 :
Multi-app functionality is not (yet?) officially supported in Merb. However, there is definitely interest in exploring possibilities to facilitate the feature.
Multi-app support is not (yet?) officially supported in Merb. However, there is definitely interest in exploring possibilities to facilitate the feature.