Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A quick & dirty git-powered Sinatra wiki
tree: 3e973e6b29

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
public/stylesheets
views
.gitignore
.rvmrc
Gemfile
Gemfile.lock
README.md
config.ru
git-wiki.rb

README.md

git-wiki

PLEASE Please note: There are some hard-coded values that I used to get myself up and running here (such as the location of the content wiki repository). Until I've removed this note, double-check the code for hard-coded stuff if you can't get yours working.

Please note: I've heavily modified potomak's git-wiki fork of sr's original code. As such, I'm changing the README to keep the current state of the documentation of THIS fork up-to-date so that anyone that forks from here will have good info on what to expect, how to install, etc.

Love, whazzmaster

December 6th, 2011

About git-wiki

git-wiki is a wiki that relies on git to keep pages' history and Sinatra to serve them.

It can be run using pow as I do, or by any server that can host Rack-based applications.

This version of git-wiki uses the Twitter Bootstrap framework to make it look fairly pretty without a lot of work. I also swapped out RDiscount for redcarpet for handling markdown processing.

Install git-wiki

Fork this repository or clone it somewhere on your disk. For the purposes of this explanation, we'll assume you clone it into ~/code/apps/git-wiki.

$ mkdir -p ~/code/apps
$ cd ~/code/apps
$ git clone git@github.com:whazzmaster/git-wiki.git

The Gemfile should contain everything you need to get started (though you may need to add additional gems such as thin or unicorn if you wish to serve using them.) Run bundle to get setup.

$ cd ~/code/apps/git-wiki
$ bundle install

The following gems are required to run git-wiki:

Setup the content repository

This confused me at first so I way to explain it explicitly: the code that runs git-wiki and the wiki content itself are stored in two completely separate repositories

The code you clone into ~/code/apps/git-wiki runs the wiki web interface, but the content is stored in a separate git repository that you will create now. Again, this can be located anywhere but we'll assume you put it in ~/.wiki.

$ mkdir ~/.wiki
$ cd ~/.wiki
$ git init

You should now be setup with an empty git repository ripe for the wiki-ing.

Serving the wiki

Now you should just need to startup whatever server you're going to use to serve this thing. So, for instance, if you're using pow, here's what you would do:

$ cd ~/.pow
$ ln -s /Users/myuser/code/apps/git-wiki

Point your browser at http://git-wiki.dev and you should now see the empty home page of your new wiki.

Using git-wiki

Listed below are non-compatible changes I've made to how git-wiki works. You could run into incompatibility issues if you try to load a wiki repo created in another version of git-wiki using this code.

WikiWords

There have been major changes in this fork to how git-wiki recognizes and processes WikiWords (i.e., the strings that denote links to other wiki pages.)

The existing functionality of the wiki_word method wasn't robust enough for what I wanted. It lacked two things:

  1. The ability to define wiki words that weren't camel cased (for example: "Golf")
  2. The ability to link to a wiki page while displaying custom text in the link.

The new wiki_word function works as follows:

  • All links to wiki pages are enclosed in double-square brackets, example: [[MyWikiPage]]
  • Names of wiki pages must begin with capital letter, and can only contain alpha-characters.
  • The first non-space containing word is the name of the page; all following words within the double-brackets are the text that will be used in the link body.

Wiki Words are translated to markdown-style links. Example: [link text](link) If no custom link text is provided, the link body will be the wiki word itself. Some examples are provided below:

[[MyWikiEntry my wiki entry]] becomes [my wiki entry](/MyWikiEntry)
[[Golf]] becomes [Golf](/Golf)

See also

Quotes

[...] the first wiki engine I'd consider worth using for my own projects.

Steve Dekorte

Oh, it looks like Git Wiki may be the starting point for what I need...

Tom Morris on "How to build the perfect wiki"

What makes git-wiki so cool is because it is backed by a git store, you can clone your wiki just like you could any other git repository. I’ve always wanted a wiki that I could a.) pull offline when I didn’t have access to the Internets and b.) edit (perhaps in bulk) in my favorite text editor. git-wiki allows both.

Cloning your wiki

Numerous people have written diff and merge systems for wikis; TWiki even uses RCS. If they used git instead, the repository would be tiny, and you could make a personal copy of the entire wiki to take on the plane with you, then sync your changes back when you're done.

Git is the next Unix

Licence

           DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
                   Version 2, December 2004

Copyright (C) 2008 Simon Rozet <simon@rozet.name>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.

           DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
  TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

 0. You just DO WHAT THE FUCK YOU WANT TO.
Something went wrong with that request. Please try again.