ruby - Make Gollum Gem work with Rails 4 -
i need add wiki pages application , i've read gollum gem.
since i'm new rails i'm not sure how integrate gems installed separately working project.
what next steps after installing gem? how accessible controller? have create own controller, view , model?
plus, can find valid examples of how manage simple wiki pages? git repository lacks examples
https://github.com/gollum/gollum
@edit
taking post example, yourapplication
in accepted answer?
how mount github's gollum wiki inside rails app?
after following these steps able use, example, markdown syntax in view , translated formatted html?
recently, i've tried mount gollum onto app. here codes routes.rb
require 'gollum/app' rails.application.routes.draw wiki_options = {:universal_toc => false} precious::app.set(:gollum_path, rails.root.join('wiki').to_s) precious::app.set(:default_markup, :markdown) # set favorite markup language precious::app.set(:wiki_options, wiki_options) mount precious::app, at:'gollum' end
i can access whole gollum using http://localhost:3000/gollum/.
i have create 'wiki' directory root , git init .
there gollum working
$ mkdir wiki $ cd wiki $ git init .
the issue i'm having right simple mounting of gollum without other features in app authentication , layout. still working on how reflect user performs commit.
as of now, it's under server git account. on side note, seems bit easier integrate gollum app using gollum-lib have reimplement front end features.
edit: authentication working using devise in routes.
authenticate :user mount precious::app, at: 'gollum' end
but comes small issue keeps getting redirect_loop because devise tries route root of gollum has not yet been authenticated. i'm trying fix redirect sign in page. until then, still serves use case not want unauthenticated users come wiki.
i add way correct author each commit in gollum using session["gollum.author"]
pass in info. did create session controller devise following configuring custom controllers
class users::sessionscontroller < devise::sessionscontroller # post /resource/sign_in def create super |resource| session['gollum.author'] = { name: resource.name, email: resource.email } end end # delete /resource/sign_out def destroy super { session['gollum.author'] = nil } end end
but reasons session['gollum.author'] hash changes keys string. have 1 final hack session['gollum.author'] hash symbol keys.
i follow post , create app class inherits previous::app , changing in routes.rb
# config/routes.rb require 'gollum/app' class app < precious::app before { assign_author } helpers def assign_author session["gollum.author"].symbolize_keys! end end end rails.application.routes.draw wiki_options = {:universal_toc => false} app.set(:gollum_path, rails.root.join('wiki').to_s) app.set(:default_markup, :markdown) app.set(:wiki_options, wiki_options) authenticate :user mount app, at:'gollum' end end
Comments
Post a Comment