Setup Feather to run as a slice within a Merb app Jan 30 2009
In response to a few queries and comments on my post about the ejdraper.com blog running as a Feather slice underneath a parent Merb application, I decided to put together a sample app demonstrating just how you’d configure such a beast.
Introducing Feather Sample Slice Host… this is an up-to-date Merb application (Merb 188.8.131.52) that hosts Feather as a slice. It comes with a few common plugins installed, and an ultra basic theme override to demonstrate the themes working. It shows how you can easily integrate Feather into a Merb application, and you should be able to use it as a base for any application that you’d like to build with Feather integrated. You need to install Feather as a gem first - for now, simply “git clone” the Feather code, and then run “sudo rake install” in the root of the Feather codebase. A configured development sqlite3 database is included with the sample app so that you should then just be able to “git clone” the host app code and fire it up!
For those that are interested, integrating Feather as a slice boils down to the following steps:
- if you haven’t already, grab Feather as a gem (same as above, clone the code, and then “sudo rake install” in the project root; this will change when the first gem version of Feather, 0.5, is officially released shortly)
- create a brand new Merb app
- add Feather, and a few of it’s dependencies to “config/dependencies.rb”
- add the appropriate Feather slice commands to the host apps router, to mount Feather at /blog (or wherever you would like)
- run “rake slices:feather:install” and “rake slices:merb-auth-slice-password:install” from the root of the host app to copy static resources over
- setup the database, using the “Feather::Database.initial_setup” method from the Merb console (“merb -i”)
- implement a login form under the “app/views/exceptions/unauthenticated.html.erb” view
- install any plugins required
- setup any themes needed (if using the themes plugin)
- implement the rest of the functionality you want in your host application!
For any of the steps above that aren’t all too clear, you should be able to refer to the sample application now to see exactly what is required. It isn’t currently as straightforward as I’d like, and as a part of the aforementioned 0.5 gem release, I’d like to provide an easy command to add Feather to a Merb application, or create a new Merb host app with Feather already installed as a slice. For now though, the above checklist alongside the sample app should have most of you up and running in no time!
As always, any questions, please feel free to contact me or leave a comment.