(no commit message)
[openafs-wiki.git] / GitWiki.mdwn
1 # Using git to edit the OpenAFS wiki
2
3 Unlike most wiki engines, which generate html from database records,
4 the wiki engine on the OpenAFS wiki site generates static html files
5 from a set of source files in markdown format. Revision history of the
6 pages is managed with git. The OpenAFS gerrit system has been
7 configured to accept git pushes to update the wiki, which means it is
8 now possible to update this site using git directly.
9
10 This page describes how to use git to create and edit pages on this wiki
11 as an alternative to the online web form. A local wiki setup is
12 described to allow you to preview changes before pushing them to the
13 public wiki. One advantage to this approach is that you can edit while
14 offline, and then submit your work later, as you would for any other git
15 based project. Also, using git for making changes is especially handy
16 when making a series of changes which should be committed together, such
17 as reorganizing pages and links.
18
19
20 Read [[GitDevelopers]] before following the instructions on this page.
21
22 ## Prerequisites
23
24 The following are needed to be able to edit the wiki pages with git.
25
26 * git installed and configured with your name and email.
27 * an OpenAFS gerrit account; see [[registering with gerrit|GitDevelopers]] for details.
28
29 A installation of the ikiwiki software on your laptop or workstation is
30 recommended so you can preview your changes before submitting them to the
31 OpenAFS wiki. This requires:
32
33 * [[ikiwiki|http://ikiwiki.info]] installation
34 * a basic ikiwiki setup file (shown below)
35 * a browser
36
37 ## Getting the wiki source pages
38
39 Use 'git clone' to get the openafs-wiki source files:
40
41     git clone git://git.openafs.org/openafs-wiki.git
42
43 This will clone the wiki git repository to a new directory called
44 'openafs-wiki'.
45
46 The commit hook which generates a gerrit 'change id' as described in
47 [[GitDevelopers]] is not required for pushing openafs-wiki changes to gerrit.
48
49 ## Setting up ikiwiki to preview your changes
50
51 This is an optional but recommended step. The ikiwiki software can be installed
52 on your laptop or workstation so you can preview your changes before publishing
53 them.  The default ikiwiki installation is intended for a server setup, so
54 users to create pages using the web-based CGI program. In this section, a
55 simplified setup is shown, which avoids some of the complexity of the ikiwiki
56 setup but allows you to preview changes made to the wiki source files.
57
58 First, install the ikiwiki package for your system.  Use `apt` to install
59 ikiwiki on a Debian or Ubuntu system.
60
61     sudo apt-get install ikiwiki
62
63 See [[ikiwiki downloads|http://ikiwiki.info/download]] for installation
64 instructions for other various platforms.
65
66 Create a minimal ikiwiki configuration file by saving the following in
67 the file '~/openafs-wiki.setup' (where <username> is your username)
68
69     use IkiWiki::Setup::Standard {
70         wikiname => 'openafs-wiki',
71         srcdir => '/home/<username>/openafs-wiki',
72         destdir => '/home/<username>/public_html/openafs-wiki',
73         url => 'http://localhost/openafs-wiki/',
74         rcs => '',
75         usedirs => 0,
76             add_plugins => [qw{goodstuff}],
77     }
78
79 The 'srcdir' should reference your local openafs-wiki git repository, created
80 by the git clone. The 'destdir' will be created by ikiwiki when the pages are
81 generated for preview. Note the 'rcs' setting is intentionally left empty in
82 this setup.
83
84 The html files can now be generated from the openafs-wiki source by 'ikiwiki'.
85 Run the following command to create the 'destdir' directory and create the
86 static html files in that directory:
87
88     ikiwiki --setup ~/openafs-wiki.setup
89
90 The pages may be previewed locally by pointing your browser at:
91
92     file:///home/<username>/public_html/openafs-wiki/index.html
93
94
95 ## Editing pages
96
97 You can now use your favorite text editor to change the markdown source and to
98 create new markdown files. When creating new files, be sure to create new links
99 on existing pages so visitors will be able to navigate to your
100 new page. Run the following `ikiwiki` command to regenerate the html files from
101 the source files.
102
103     ikiwiki --setup ~/openafs-wiki.setup --refresh
104
105 To preview a page, point your browser at:
106
107     file:///home/<username>/public_html/openafs-wiki/<NameOfPage>.html
108
109 When you are satified with your changes, use `git add` and `git commit` to
110 create a commit to be submitted, then to publish your changes on the wiki, push
111 your commits directly to the 'master' branch of the openafs-wiki.git repository
112 on gerrit.
113
114     git push ssh://gerrit.openafs.org/openafs-wiki.git HEAD:refs/heads/master
115
116 The changes will not be held by gerrit for review.  The commit will be merged
117 immediately to the openafs-wiki.git repository and the html on the wiki server
118 will be automatically updated after a successful 'git push'.
119