如何在Rails应用程序中正确安装github的gollum Wiki? [英] How to properly mount github's gollum wiki inside a Rails App?

查看:149
本文介绍了如何在Rails应用程序中正确安装github的gollum Wiki?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过将我的应用程序作为机架应用程序安装在我的route.rb文件中来为我的应用程序提供基于gollum的Wiki:

I'm trying to provide a gollum based wiki for my app by mounting it as a rack application inside my routes.rb file:

require 'gollum/frontend/app'

#Gollun config

gollum_path = Rails.root
Precious::App.set(:gollum_path, gollum_path)
Precious::App.set(:wiki_options, {:universal_toc => false})

TestWiki::Application.routes.draw do
  mount Precious::App, :at => "wiki"
end

该Wiki应该在'/ wiki'上运行,但每次都运行转到该URL,它将我重定向到 / wiki / create / Home ,并在创建页面后将我重定向到 / wiki / wiki / page_name

我是否缺少某些选择?

The wiki is supposed to run at '/wiki' but everytime a go to this url it redirects me to /wiki/create/Home, and after a create a page it redirects me to /wiki/wiki/page_name.
Am I missing some option? is this even possible?

推荐答案

我将与您分享为使它现在能够正常工作所做的工作。我实际上从上面的代码开始,并对其进行了调整,直到得到排序为止。如果您仍在使用它,也许它会为您工作。

I'll share with you what I did to get it working just now. I actually started with your code above and tweaked it until I got it sorted. If you're still hacking on it, maybe it'll work for you.

在Gemfile中:

gem 'gollum'

routes.rb:

In routes.rb:

require 'gollum/app'

YourApplication::Application.routes.draw do
  Precious::App.set(:gollum_path, Rails.root.join('wiki').to_s)
  Precious::App.set(:default_markup, :markdown) # set your favorite markup language
  Precious::App.set(:wiki_options, {:universal_toc => false})
  mount Precious::App, at: 'wiki'
end

然后,这是最重要的部分,创建并初始化Wiki目录:

Then, and this is the most important part, create and initialize the wiki directory:

~/Sites/ams$ mkdir wiki
~/Sites/ams$ cd wiki
~/Sites/ams/wiki$ ls
~/Sites/ams/wiki$ git init .
Initialized empty Git repository in /Users/xxx/Sites/ams/wiki/.git/

关闭服务器,捆绑安装,重新启动服务器,然后按/ wiki。

Shut down the server, bundle install, restart the server, and hit /wiki.

祝您好运。

编辑2014-11-06:最新版的gollum具有与原始撰写时略有不同的目录结构。我已经更新了route.rb示例以匹配最新的古兰经和铁路。

Edit 2014-11-06: The latest release of gollum has a slightly different directory structure than at the time of the original writing. I've updated the routes.rb sample to match the latest gollum and rails.

这篇关于如何在Rails应用程序中正确安装github的gollum Wiki?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆