Permalink
Browse files

Git back-end

  • Loading branch information...
1 parent a26c779 commit e575a32dec3c1b9b515c8cf8977258b8b9881421 @cgay cgay committed May 15, 2011
Showing with 2,905 additions and 1,203 deletions.
  1. +1 −0 .gitignore
  2. +174 −4 README.rst
  3. +35 −9 TODO
  4. +21 −9 koala-config.xml → config.xml
  5. +39 −38 dylan/access.dylan
  6. +0 −60 dylan/dsp.dylan
  7. +9 −5 dylan/feed.dylan
  8. +7 −21 dylan/file.dylan
  9. +1,002 −0 dylan/git-storage.dylan
  10. +141 −107 dylan/group.dylan
  11. +88 −20 dylan/library.dylan
  12. +83 −57 dylan/main.dylan
  13. +1 −1 dylan/monday-parser.dylan
  14. +326 −425 dylan/page.dylan
  15. +3 −3 dylan/parser.dylan
  16. +1 −1 dylan/tag.dylan
  17. +15 −2 dylan/tests/library.dylan
  18. +20 −0 dylan/tests/main.dylan
  19. +7 −30 dylan/tests/{wiki-test-suite.dylan → test-acls.dylan}
  20. +237 −0 dylan/tests/test-storage.dylan
  21. +3 −1 dylan/tests/wiki-test-suite.lid
  22. +321 −113 dylan/user.dylan
  23. +318 −207 dylan/wiki.dylan
  24. +1 −1 dylan/wiki.lid
  25. +2 −2 www/dsp/{remove-user.dsp → deactivate-user.dsp}
  26. +1 −1 www/dsp/edit-group-members.dsp
  27. +1 −2 www/dsp/edit-group.dsp
  28. +1 −1 www/dsp/edit-page.dsp
  29. +1 −1 www/dsp/footer.dsp
  30. +2 −2 www/dsp/group-options-menu.dsp
  31. +0 −1 www/dsp/header.dsp
  32. +1 −2 www/dsp/list-groups.dsp
  33. +22 −29 www/dsp/list-recent-changes.dsp
  34. +0 −1 www/dsp/non-existing-group.dsp
  35. +0 −1 www/dsp/non-existing-user.dsp
  36. +0 −1 www/dsp/not-logged-in.dsp
  37. +1 −1 www/dsp/options-menu.dsp
  38. +0 −27 www/dsp/page-authors.dsp
  39. +1 −1 www/dsp/remove-page.dsp
  40. +1 −1 www/dsp/user-options-menu.dsp
  41. +9 −5 www/dsp/view-diff.dsp
  42. +0 −1 www/dsp/view-group-body.dsp
  43. +7 −7 www/dsp/{list-page-versions.dsp → view-page-history.dsp}
  44. +2 −2 www/dsp/view-page.dsp
View
@@ -0,0 +1 @@
+*~
View
@@ -1,15 +1,185 @@
wiki
====
-Build the library and then run it like this::
+This library is a wiki written in the Dylan language. It supports the
+following features:
+
+ * All data is stored in a git repository so it can be edited offline
+ if desired, backed up, reverted, etc.
+
+ * Account verification.
+
+ * Access controls -- each page in the wiki can be restricted to
+ being viewed or edited by specific sets of users.
+
+Currently the parser is very rudimentary. The plan is to replace it,
+possibly with an augmented version of Restructured Text so that the
+page source is as readable as possible.
- wiki --config koala-config.xml
+Configuration
+=============
You will need to tweak these values in the config file:
-* *koala.wiki.static-directory* -- Make it point at the "www" subdirectory.
+* **koala.wiki.repository** -- Make it point to the root directory of
+ your wiki git repository. Example::
+
+ $ cd
+ $ mkdir wiki-data
+ $ cd wiki-data
+ $ git init
+
+ <wiki repository = "/home/you/wiki-data" ...>
+
+* **koala.wiki.user-repository** -- Make this point to the root directory
+ of the user data repository. This is separate from the page and group
+ data so that it can easily be backed-up separately (e.g., by pushing
+ to a different remote). Example::
+
+ $ cd
+ $ mkdir wiki-user-data
+ $ cd wiki-user-data
+ $ git init
+
+ <wiki user-repository = "/home/you/wiki-user-data" ...>
+
+* **koala.wiki.git-executable** -- If the "git" executable is not on the
+ path of the user running the wiki, then you need to specify it in
+ the <wiki> element::
+
+ <wiki git-executable = "/usr/bin/git" ... />
+
+* **koala.wiki.static-directory** -- Make it point at the "www" subdirectory
(I guess this should be made relative to <server-root>.)
-* *koala.wiki.administrator.password* -- Choose a password you like.
+* **koala.wiki.administrator.password** -- Choose a password you like.
+
+
+Startup
+=======
+
+Build the library and then run it like this::
+
+ wiki --config config.xml
+
+
+
+Data File Layouts
+=================
+
+All wiki data are stored in a git repository. "Public" data is stored
+in one repository and "private" data in another. The only private
+data is the user database. Pages and groups are stored in the public
+repo.
+
+In order not to end up with too many files in a single directory
+(which may just be a superstition these days, and is really only a
+worry for pages anyway) users, groups, and pages are divided into
+subdirectories using the first few letters of their name/title. e.g.,
+a page entitled "Green Stripe" would be stored in the directory named
+``sandboxes/main/Gre/Green Stripe/``. Similarly for users and groups,
+although they use a shorter prefix on the theory that there will be a
+lot fewer of them.
+
+Example::
+
+ <public-repo-root>/
+ groups/
+ a/
+ <a-group-1>
+ <a-group-2>
+ ...
+ b/
+ <b-group-1>
+ <b-group-2>
+ ...
+ c/
+ ...
+
+ pages/
+ <sandbox-1>/
+ <prefix-1>/
+ <page-name-1>/content # page markup
+ <page-name-1>/tags # page tags
+ <page-name-1>/acls # page ACLs
+ <page-name-1>/links # pages that link to this page
+ <page-name-2>/content
+ <page-name-2>/tags
+ <page-name-2>/acls
+ <page-name-2>/links
+ ...
+ <prefix-2>/
+ ...
+ <sandbox-2>/
+ <prefix-1>/
+ <page-name-1>/content
+ <page-name-1>/tags
+ <page-name-1>/acls
+ ...
+
+ <private-repo-root>/
+ users/
+ a/
+ <a-user-1>
+ <a-user-2>
+ ...
+ b/
+ <b-user-1>
+ <b-user-2>
+ ...
+ ...
+ z/
+
+The default sandbox name is "main" and currently there is no way to
+create new sandboxes. In some other wikis these would be called
+"wikis". The format of each file is described below.
+
+content
+ The ``content`` file contains the raw wiki page markup text and
+ nothing else.
+
+tags
+ The ``tags`` file contains one tag per line and nothing else. Tags may
+ contain whitespace.
+
+acls
+ The ``acls`` file has the following format::
+
+ owner: <username>
+ view-content: <rule>,<rule>,...
+ modify-content: <rule>,<rule>,...
+ modify-acls: <rule>,<rule>,...
+
+ Rules are defined by the following pseudo BNF::
+
+ <rule> ::= <access><name>
+ <access> ::= - | + // '-' = deny, '+' = allow
+ <name> ::= <user> | <group> | $any | $trusted | $owner
+ <user> ::= any user name
+ <group> ::= any group name
+
+ The special name "$any" means any user, "$trusted" means logged in users
+ and "$owner" means the page owner. "$" is not allowed in user or group
+ names so there is no conflict.
+
+<a-group-1>
+ iso8601-creation-date
+ name:owner:member1:member2:...
+ <n-bytes>
+ ...description in n bytes...
+
+<a-user-1>
+ iso8601-creation-date
+ username1:Real Name:admin?:password:email:activation-key:active?
+
+ Passwords are stored in base-64 for now, to be slightly better
+ than clear text. This must be improved. Email is also in
+ base-64.
+
+Backlinks (Page References)
+===========================
+
+Use for: users to see what points to a page
+Update page = update backlink file for all pages it references or dereferences.
View
44 TODO
@@ -1,8 +1,10 @@
Fix before going live
---------------------
-Anything that is a regression compared to the original wiki.
-
+* Page back links
+* Rename page/user/group need to update page references.
+* Recent changes
+* Disable UI access to unfinished TODO--* items.
* Convert the content in www.opendylan.org to wiki pages and make
them only editable by the dylan-hackers group.
* The methods on permanent-link are incorrect. For example, if you go
@@ -12,6 +14,8 @@ Anything that is a regression compared to the original wiki.
* Write all the hard-linked pages in the navigation bar (and the news items)
in the old wiki so they're available immediately after conversion. All
we need to do after conversion is add the "news" tag.
+* ATOM feeds?
+* List page revisions?
General
-------
@@ -27,6 +31,9 @@ General
* navigation.dsp should be able to include wiki pages so that it can
be customizable on a per-site and/or per-user basis.
* i18n
+* Implement all dsp pages the same way: with a class and respond-to-*
+ methods. Having some be functions and some be classes is annoying
+ because it's harder to remember the names of things.
Browser Compatibility
---------------------
@@ -48,13 +55,25 @@ Feeds
Markup Language
---------------
-* Support ReStructured Text as a markup language, probably doing a first
- pass over the source to process wiki links etc and then pass the result
- to rst2html, since it hardly seems wise to re-implement all of RST.
- Virtually all the features/bugs listed in the old "Wiki To-Do List"
- wiki page are solved by this.
-* Support the original markup language until all pages have been converted
- to something newer.
+
+* Change markup language to augmented ReStructured Text. A first pass
+ will be done, searching for wiki links of the form::
+
+ {{page: Foo, text: Bar}} -- link text "Bar" to page "Foo"
+ {{Foo,Bar}} -- shorthand for {{page:Foo,text:Bar}}
+ {{Foo}} -- shorthand for {{page:Foo,text:Foo}}
+ {{page: "x,y"}} -- names may be quoted
+ {{page: 'The "x" Page'}} -- single or double quotes work.
+ {{user: cgay, text: Carl}} -- a user link
+ {{group: group}} -- a group link
+ {{wiki: off}} -- turn off wiki markup parsing
+ {{wiki: on}} -- turn it back on
+
+ Also, in order to manage the overall layout of the page, the wiki
+ parser will need to combine the header, nav bar, footer, and main
+ page into one document before passing them to rst2html. It can wrap
+ each part with a different <div> element, so that the layout can be
+ managed via CSS.
Tags
----
@@ -99,6 +118,13 @@ Groups
Pages
-----
+* Currently (as I rewrite to use git as the back end) I plan for most
+ operations to execute git commands directly rather than caching
+ anything. Ultimately that will probably be too slow as the number
+ of pages grows. One possible way forward will be to create a <page>
+ object for each page, without filling in the content, parsing tags,
+ etc., then fill in the page content as pages are loaded on demand.
+ For full content search we'll need an index.
* Preview doesn't work if the page is new, never saved.
* Looks like show-page-responder doesn't respect "view" ACLs (but I could
be wrong because I've been away from the code for a while).
@@ -6,13 +6,24 @@
<koala>
<listener address="0.0.0.0" port="8000"/>
- <debug-server value="off" />
- <development-mode enabled="yes" />
+
+ <server
+ use-default-virtual-host="yes"
+ debug="no"
+ />
+
+ <dsp reparse-templates="yes" />
<!-- TODO: site-name and site-url should be in an <atom> or <feed> element. -->
<!--
- content-directory
- Where to store wiki content.
+ git-repository-root (required)
+ Full path of main git repository. This is where wiki page
+ and group data is stored.
+ git-user-repository-root (required)
+ Full path of user git repository. This is where user data
+ is stored. You may want to keep this data secure.
+ git-executable (optional)
+ Full path of git executable (default: "git").
site-name
Sent as the title of Atom feeds.
site-url
@@ -24,17 +35,18 @@
This should point to the wiki project directory; the one
containing the www, dylan, and dsp subdirectories.
-->
- <wiki content-directory="."
- site-name="Dylan Wiki"
+ <wiki site-name="Dylan Wiki"
site-url="http://localhost"
url-prefix="/wiki"
static-directory="c:/cgay/dylan/git/wiki/www"
- >
+ git-repository-root="c:/tmp/wiki/main-storage"
+ git-user-repository-root="c:/tmp/wiki/user-storage"
+ git-executable="c:/Program Files/Git/bin/git"
+ >
<!-- Note that the administrator's email address will be the one
from which account emails are sent, so it runs a high spam risk.
-->
- <administrator username="admin"
- password="xxxx"
+ <administrator password="xxxx"
email="...@opendylan.org"/>
<authentication realm="dylan-wiki"/>
<mail host="localhost"/>
Oops, something went wrong.

0 comments on commit e575a32

Please sign in to comment.