Birdses
Birdses implements views for gollum as a mountable rails engine.
Add Birdses to your rails application in four easy steps:
- add
gem 'birdses'
to your Gemfile and runbundle install
- add
mount Birdses::Engine => "/wiki"
to yourconfig/routes.rb
- add
//= require birdses/pages
to yourapplication.js
- init a git repository under
wiki/
(mkdir -p wiki && git init wiki
)
Why?
But why, why would you want to do this? After all you can already mount gollum's sinatra application. Well that works just fine, however gollum's frontend and your rails application wont look like they belong together. Gollum's frontend can't use your ApplicationLayout, which means you would lose that great menu bar twitter bootstrap gives you and that's just sad!
Example
You can see an example here. It also runs on heroku, just give it a couple of seconds to spin up the dyno. :)
Caveats
current_user
If you're using an authentication system that provides a current_user
method (like devise), birdses will try to access .fullname
and .email
(on current_user
). It will use these for the commit messages.
_url
/_path
If you use any magic url mappers (any method that ends with _path
or _url
) in the application layout you will have to use the main_app
helper.
For example, I use Twitter Bootstrap and have a 'Sign Out' link in my navigation bar. For it to work properly with birdses I have to prepend the helper method.
without birdes:
# ...
- if current_user
%li= link_to('Sign Out', destroy_user_session_path, method: :delete)
# ...
with birdses:
# ...
- if current_user
%li= link_to('Sign Out', main_app.destroy_user_session_path, method: :delete)
# ...
Otherwise you will get errors like this, when accessing the mounted wiki:
NameError in Birdses/pages#index
Showing /Users/max/code/snap_app/app/views/layouts/application.html.haml where line #43 raised:
undefined local variable or method `destroy_user_session_path' for
#<#<Class:0x007fd67c3d6418>:0x007fd67afb3508>