gf-Soks 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE.txt +66 -0
- data/README.txt +64 -0
- data/bin/soks-create-wiki.rb +193 -0
- data/contrib/diff/lcs.rb +1105 -0
- data/contrib/diff/lcs/array.rb +21 -0
- data/contrib/diff/lcs/block.rb +51 -0
- data/contrib/diff/lcs/callbacks.rb +322 -0
- data/contrib/diff/lcs/change.rb +169 -0
- data/contrib/diff/lcs/hunk.rb +257 -0
- data/contrib/diff/lcs/ldiff.rb +226 -0
- data/contrib/diff/lcs/string.rb +19 -0
- data/contrib/diff_licence.txt +76 -0
- data/contrib/easyprompt.rb +58 -0
- data/contrib/easyprompt_licence.txt +504 -0
- data/contrib/redcloth-3.0.3.rb +1113 -0
- data/contrib/redcloth_license.txt +27 -0
- data/lib/authenticators.rb +121 -0
- data/lib/helpers/counter-helpers.rb +132 -0
- data/lib/helpers/default-helpers.rb +416 -0
- data/lib/helpers/mail2wiki-helper.rb +105 -0
- data/lib/helpers/maintenance-helpers.rb +149 -0
- data/lib/helpers/rss2wiki-helper.rb +47 -0
- data/lib/helpers/wiki2html.rb +60 -0
- data/lib/soks-model.rb +271 -0
- data/lib/soks-servlet.rb +177 -0
- data/lib/soks-storage.rb +187 -0
- data/lib/soks-upgrade-0.0.2.rb +70 -0
- data/lib/soks-utils.rb +327 -0
- data/lib/soks-view.rb +399 -0
- data/lib/soks.rb +27 -0
- data/rakefile +109 -0
- data/templates/default/attachment/favicon.ico +0 -0
- data/templates/default/attachment/logo.jpg +0 -0
- data/templates/default/attachment/logo.png +0 -0
- data/templates/default/attachment/logo.tiff +0 -0
- data/templates/default/attachment/newpage.js +41 -0
- data/templates/default/attachment/print_stylesheet.css +2 -0
- data/templates/default/attachment/robots.txt +6 -0
- data/templates/default/attachment/rss.png +0 -0
- data/templates/default/attachment/stylesheet.css +219 -0
- data/templates/default/banned_titles.txt +67 -0
- data/templates/default/caches/readme.txt +1 -0
- data/templates/default/content/Api%20for%20classes%20to%20modify%20the%20wiki.textile +30 -0
- data/templates/default/content/Author.textile +16 -0
- data/templates/default/content/Automatic%20Summaries.textile +40 -0
- data/templates/default/content/Automatic%20counters.textile +22 -0
- data/templates/default/content/Automatic%20exporters.textile +23 -0
- data/templates/default/content/Automatic%20importers.textile +59 -0
- data/templates/default/content/Automatic%20linking.textile +7 -0
- data/templates/default/content/Automatic%20maintenance%20helpers.textile +39 -0
- data/templates/default/content/Bug%3A%20Competing%20edits.textile +22 -0
- data/templates/default/content/Bug%3A%20Does%20not%20make%20use%20of%20if%2Dmodified%2Dsince%20r.textile +3 -0
- data/templates/default/content/Bug%3A%20Email%20adresses%20in%20page%20titles%20cause%20incorrec.textile +3 -0
- data/templates/default/content/Bug%3A%20GEM%20limits%20title%20lengths.textile +3 -0
- data/templates/default/content/Bug%3A%20Memory%20leak.textile +13 -0
- data/templates/default/content/Bug%3A%20Page%2Einserted%5Finto%20is%20never%20purged.textile +17 -0
- data/templates/default/content/Bug%3A%20Pages%20that%20link%20here%20may%20not%20appear%20on%20r.textile +13 -0
- data/templates/default/content/Bug%3A%20Textile%20mishandles%20paragraphs.textile +37 -0
- data/templates/default/content/Bug%3A%20Unanticipated%20Rollbacks.textile +23 -0
- data/templates/default/content/Bug%3A%20notextile%20does%20not%20prevent%20page%20inserts.textile +3 -0
- data/templates/default/content/Home%20Page.textile +22 -0
- data/templates/default/content/How%20to%20administrate%20this%20wiki.textile +57 -0
- data/templates/default/content/How%20to%20change%20the%20way%20this%20wiki%20looks.textile +32 -0
- data/templates/default/content/How%20to%20export%20a%20site%20from%20this%20wiki.textile +82 -0
- data/templates/default/content/How%20to%20get%20the%20latest%20Soks%20from%20cvs.textile +45 -0
- data/templates/default/content/How%20to%20hack%20soks.textile +66 -0
- data/templates/default/content/How%20to%20import%20a%20site%20from%20instiki.textile +15 -0
- data/templates/default/content/How%20to%20import%20data.textile +41 -0
- data/templates/default/content/How%20to%20install%20Soks.textile +33 -0
- data/templates/default/content/How%20to%20password%20protect%20your%20wiki.textile +53 -0
- data/templates/default/content/How%20to%20re%2Dbuild%20the%20page%20cache.textile +71 -0
- data/templates/default/content/How%20to%20report%20a%20bug.textile +9 -0
- data/templates/default/content/How%20to%20upgrade%20soks.textile +32 -0
- data/templates/default/content/How%20to%20use%20the%20Automatic%20Helper%20classes.textile +12 -0
- data/templates/default/content/How%20to%20use%20this%20wiki.textile +30 -0
- data/templates/default/content/List%20of%20changes.textile +10 -0
- data/templates/default/content/News%3A%20Version%201%2D0%2D0%20released.textile +19 -0
- data/templates/default/content/News%3A%20Version%201%2D0%2D1%20released.textile +12 -0
- data/templates/default/content/Pages%20to%20include%20in%20the%20distribution.textile +55 -0
- data/templates/default/content/Per%20Wiki%20Templates.textile +37 -0
- data/templates/default/content/Picture%20of%20a%20pair%20of%20soks.textile +1 -0
- data/templates/default/content/Planned%20Features.textile +74 -0
- data/templates/default/content/README.textile +64 -0
- data/templates/default/content/RSS%20feed.textile +9 -0
- data/templates/default/content/Recent%20changes%20to%20this%20site.textile +352 -0
- data/templates/default/content/SOKS%20features.textile +19 -0
- data/templates/default/content/Sidebar%20Page.textile +6 -0
- data/templates/default/content/Site%20Index.textile +241 -0
- data/templates/default/content/Soks%27s%20Licence.textile +66 -0
- data/templates/default/content/Tag%3A%20Include%20this%20page%20in%20the%20distribution.textile +6 -0
- data/templates/default/start.rb +90 -0
- data/templates/default/version.txt +1 -0
- data/templates/default/views/Page_content.rhtml +1 -0
- data/templates/default/views/Page_edit.rhtml +79 -0
- data/templates/default/views/Page_find.rhtml +35 -0
- data/templates/default/views/Page_linksfromrss.rhtml +24 -0
- data/templates/default/views/Page_listrss.rhtml +46 -0
- data/templates/default/views/Page_meta.rhtml +44 -0
- data/templates/default/views/Page_print.rhtml +6 -0
- data/templates/default/views/Page_revision.rhtml +39 -0
- data/templates/default/views/Page_revisions.rhtml +36 -0
- data/templates/default/views/Page_rss.rhtml +57 -0
- data/templates/default/views/Page_view.rhtml +8 -0
- data/templates/default/views/UploadPage_edit.rhtml +63 -0
- data/templates/default/views/frame.rhtml +63 -0
- data/templates/default/views/messages.yaml +7 -0
- data/test/html/2006Mar.html +66 -0
- data/test/html/poignant.html +36 -0
- data/test/html/poignant.textile +36 -0
- data/test/mock-objects.rb +69 -0
- data/test/test_counter-helper.rb +162 -0
- data/test/test_soks-helper-maintenance.rb +106 -0
- data/test/test_soks-helpers.rb +145 -0
- data/test/test_soks-model.rb +144 -0
- data/test/test_soks-servlet.rb +240 -0
- data/test/test_soks-storage.rb +108 -0
- data/test/test_soks-utils.rb +226 -0
- data/test/test_soks-view.rb +193 -0
- data/test/test_soks.rb +9 -0
- metadata +182 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
h1. How to get the latest Soks from cvs
|
|
2
|
+
|
|
3
|
+
Note. Soks now uses Darcs rather than CVS for development.
|
|
4
|
+
|
|
5
|
+
If you can't wait for the next release of Soks, then you can get a copy out of the source control system. Note that the cvs copy of Soks *{color:red}may have serious bugs*, so please don't try and upgrade a running site with it.
|
|
6
|
+
|
|
7
|
+
There are now three repositories:
|
|
8
|
+
* [[Soks-stable => changes to soks-stable]], that contains code that has been, or will shortly be, released.
|
|
9
|
+
* [[Soks-testing => changes to soks-stable]], that contians code that will probably make it to the next release. www.soks.org uses the code from here.
|
|
10
|
+
* [[Soks-development => changes to soks-development]], that contains ideas and experiments.
|
|
11
|
+
|
|
12
|
+
There is a repository browser at http://www.counsell.org/darcs.
|
|
13
|
+
|
|
14
|
+
h2. Just download and go
|
|
15
|
+
|
|
16
|
+
I will try and maintain an up to date tar.gz copy of the repositories. Unfortunately, until I find a way to hook into Darcs to create this on every change, it may not be 100% up to date.
|
|
17
|
+
|
|
18
|
+
# @wget http://www.counsell.org/darcs/soks-stable/soks-stable.tar.gz@
|
|
19
|
+
# @tar -xvzf soks-stable.tar.gzip@
|
|
20
|
+
# @cd soks-stable@ and play
|
|
21
|
+
|
|
22
|
+
Substitute soks-development or soks-testing for soks-stable if you require a different version.
|
|
23
|
+
|
|
24
|
+
h2. Using Darcs
|
|
25
|
+
|
|
26
|
+
Steps:
|
|
27
|
+
# If you don't have a copy of darcs, get it from www.darcs.net
|
|
28
|
+
# Go into a terminal
|
|
29
|
+
# @cd wherever_you_want_to_download_soks_to@
|
|
30
|
+
# @darcs get http://www.counsell.org/darcs/soks-stable@
|
|
31
|
+
# @cd soks-stable@ and play.
|
|
32
|
+
|
|
33
|
+
To update a repository you allready have:
|
|
34
|
+
# @cd wherever_you_downloaded_soks@
|
|
35
|
+
# @darcs pull http://www.counsell.org/darcs/soks-stable@
|
|
36
|
+
# Note, you can use this to pull specific patches from different versions of soks.
|
|
37
|
+
|
|
38
|
+
To send me a patch:
|
|
39
|
+
# @cd wherever_you_downloaded_soks@
|
|
40
|
+
# @darcs record@ to save your changes to your local copy
|
|
41
|
+
# Send it to me:
|
|
42
|
+
** @darcs send@ if your machine and firewall are configured so that sendmail works.
|
|
43
|
+
** @darcs send -o=patch-file.txt@ then e-mail darcs@soks.org with the patch-file attached.
|
|
44
|
+
|
|
45
|
+
Tag: Include this page in the distribution
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
h1. How to hack soks
|
|
2
|
+
|
|
3
|
+
Here are some pointers to help you figure out where to make whatever changes and improvements you desire. Soks's licence is liberal, so please do whatever you want, but I would appreciate any improvements you can send me ( tamc@rubyforge.com ).
|
|
4
|
+
|
|
5
|
+
* bin - contains the soks-create-wiki.rb file
|
|
6
|
+
* contrib - contains code from other people. Currently Redcloth and Diff:LCS
|
|
7
|
+
** _Could these dependencies be resolved directly by RubyGems in future Soks releases?_
|
|
8
|
+
** They _could_, but I'd have to figure out how to make rake package the gem differently from the zip and tgz file, so it has seemed simpler just to include them for now.
|
|
9
|
+
* lib - contains the soks code
|
|
10
|
+
* template - contains the defaults used by soks-create-wiki.rb when creating a new wiki. This folder is copied over, and the show.rb template filled out.
|
|
11
|
+
|
|
12
|
+
h2. template
|
|
13
|
+
|
|
14
|
+
* start.rb - contains the default ruby file used by soks-create-wiki.rb, this is written using erb
|
|
15
|
+
* attachments - contains the stuff that will be statically loaded when running a wiki, such as images and stylesheets. In particular you may want to replace logo.png
|
|
16
|
+
* views - contains the default templates see Improving the style of this wiki for a few notes on this
|
|
17
|
+
* content - contains the initial content for the wiki. The .textile files are flatfile text files containing the textile for a page. The title of the page is the filename (and has usually been url_encoded). Any .yaml files in here contain arrays containing the change history of the page
|
|
18
|
+
* version - contains the version number of this wiki. Used by soks-create-wiki.rb to see if it needs upgrading.
|
|
19
|
+
|
|
20
|
+
h2. lib
|
|
21
|
+
|
|
22
|
+
* soks.rb - Just requires all the other files
|
|
23
|
+
* soks-utils.rb - Contains various utility classes, EventQueue, Notify and some extensions to String to url_encode and decode
|
|
24
|
+
* soks-storage.rb - Contains a module which is mixed into the Wiki class to allow it to be saved
|
|
25
|
+
* soks-model.rb - Contains the model of the wiki: Wiki, Page and Revision
|
|
26
|
+
* soks-view.rb - Contains the classes that turn the wiki into html: View, WikiRedCloth, Links, RollingMatch
|
|
27
|
+
* soks-servlet.rb - Contains the webrick server that passes commands to and from the View object
|
|
28
|
+
* soks-default-helpers.rb - Contains optional classes that a Wiki can load to provide added functionality. These are called when changes are made to the site. They include: AutomaticUpdateCrossLinks, AutomaticRecentChanges, AutomaticOnePageIndex, AutomaticMultiPageIndex, AutomaticSummary, AutomaticCalendar and AutomaticUpcomingEvents.
|
|
29
|
+
* authenticators.rb - Contains some extra authenticators to extend those already provided by Webrick. Namely NotAuthentication and OnePasswordAuthentication
|
|
30
|
+
|
|
31
|
+
h3. soks-utils.rb
|
|
32
|
+
|
|
33
|
+
* Notify - This is an improvement on the Observable mix-in.
|
|
34
|
+
* EventQueue - This is used by Notify to inform observers in sequence of an event taking place, while allowing the original triggering class to continue.
|
|
35
|
+
|
|
36
|
+
h3. soks-model.rb
|
|
37
|
+
|
|
38
|
+
A Wiki class has many Page classes which have many Revision classes. ImagePage and AttachmentPage are subclasses of Page that return different textile.
|
|
39
|
+
|
|
40
|
+
The Wiki class decides what type of page to create based on its name. All AttachmentPage pages have names that start with 'Attached ', all ImagePage pages have names that start with 'Picture of'. This is defined in the @page_classes instance variable of the Wiki class.
|
|
41
|
+
|
|
42
|
+
The Wiki loads all the pages from file into a hash. When pages are changed it writes a copy to disk immediately. It has a thread that watches the disk for any changes to the files.
|
|
43
|
+
|
|
44
|
+
h3. soks-view.rb
|
|
45
|
+
|
|
46
|
+
The View object does the business. It is called by the soks-servlet, and then proceeds to call an appropriate method on the Wiki model. It may then Notify any observing AutomaticHelpers of any changes, before proceeding to render the html. This rendering happens in two places: First the Page.textile is turned into html by WikiRedCloth. then an appropriate ERB file is loaded and called.
|
|
47
|
+
|
|
48
|
+
The WikiRedCloth overrides the to_html method of redcloth to add a number of methods that do the automatic page insertion and automatic linking. The automatic linking is actually carried out in the RollingMatch class. A record of the links between pages is kept in the Links class and then written to each page object.
|
|
49
|
+
|
|
50
|
+
The ERB files are loaded from disk. The appropriate erb file is selected by looking for the pattern ClassName_viewname.rhtml (e.g. Page_edit.rhtml). If that page doesn't exist then the process is repeated with the Page's superclass. The ERB files are cached.
|
|
51
|
+
|
|
52
|
+
h3. soks-servlet.rb
|
|
53
|
+
|
|
54
|
+
This runs a Webrick server to interact with the user. The server can be stopped by sending an interupt (ctrl-c).
|
|
55
|
+
|
|
56
|
+
The server has two handlers, a WEBrick::HTTPServlet::FileHandler for doing the dynamic content (which is attached to any url starting in /attachment/) and a WikiServlet for the dynamic content.
|
|
57
|
+
|
|
58
|
+
The WikiServlet service method takes a look at the request url. If it is '/' it redirects to '/view/Home Page'. If it only has one slash in it (e.g. '/Home Page') then it assumes that it is equivalent to '/view/Home Page'. If it has two or more slashes in it (e.g. '/edit/Home Page' ) then it splits the url into a command ('edit') and the rest ('Home Page'). If the WikiServlet responds to doCommand (e.g. doEdit) then control is passed to that method. Otherwise it is assumed the command is the name of a view (e.g. 'print') and is therefore passed as is to the View object.
|
|
59
|
+
|
|
60
|
+
The WikiServlet deals with file uploads by separately writing the uploaded file to the 'attachments' directory and also asking the 'View' object to create or revise an ImagePage object whose content is the filename of the uploaded file.
|
|
61
|
+
|
|
62
|
+
h4. soks-default-helpers.rb
|
|
63
|
+
|
|
64
|
+
These are a series of classes that may be optionally loaded by a wiki's start.rb script. They receive notifications of page changes from the View object and can use this information to update other pages in the wiki. See automatic summaries for a little more detail.
|
|
65
|
+
|
|
66
|
+
Tag: Include this page in the distribution
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
h1. How to import a site from instiki
|
|
2
|
+
|
|
3
|
+
[[ Instiki => www.instiki.org ]] is great, and was definitely an inspiration for this site. If, however, you wish to import a wiki from instiki to here then you need to:
|
|
4
|
+
|
|
5
|
+
# Launch your instiki wiki
|
|
6
|
+
# Go to 'export' and click on 'Markup (textile)'
|
|
7
|
+
# Unzip the downloaded folder.
|
|
8
|
+
# Create a soks wiki: <code>soks-create-wiki.rb</code>
|
|
9
|
+
# Stop the wiki <code>ctrl-c</code>
|
|
10
|
+
# Copy the contents of the downloaded folder (step 3) into soks-wiki/content
|
|
11
|
+
# Start the wiki <code>ruby soks-wiki/start.rb</code>
|
|
12
|
+
|
|
13
|
+
Your instiki content should then appear. Note that all the links still work, but that all the pages have their WikiWord names.
|
|
14
|
+
|
|
15
|
+
Tag: Include this page in the distribution
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
h1. How to import data into a Soks wiki
|
|
2
|
+
|
|
3
|
+
*The basic question:* How can I import data into Soks? (both pages and attachments)
|
|
4
|
+
|
|
5
|
+
I have a table worth of information that I would like to load into my Soks wiki. Each row of the table will become a page and each row has a PDF file associated with it.
|
|
6
|
+
|
|
7
|
+
What would be the process of dumping my tabular data in the wiki? Do I merely need to dump out @.textile@ versions of the pages in the contents directory (properly escaped)? Do I need the YAML revision companions? Do I merely dump the PDF files in the @attachments@ directory (with proper @.textile@ files also placed in @contents@)?
|
|
8
|
+
|
|
9
|
+
So far, I have something like,
|
|
10
|
+
<pre>
|
|
11
|
+
projects.each do |p|
|
|
12
|
+
name = CGI.escape("2005 ii Proposal: #{p.organization}: #{p.title}")
|
|
13
|
+
File.open(name+'.textile','w') do |f|
|
|
14
|
+
f.puts "h2. #{p.title}"
|
|
15
|
+
f.puts
|
|
16
|
+
f.puts "|Author:|#{p.author}|"
|
|
17
|
+
f.puts "|Organization:|#{p.organization}|"
|
|
18
|
+
f.puts "|FTE:|#{p.fte}"
|
|
19
|
+
f.puts "|Beneficiary:|#{p.beneficiary}|"
|
|
20
|
+
f.puts "|Submission:|Attached #{p.proposal.gsub(/\s/,'+').sub(/\..*?$/,'')}|"
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
</pre>
|
|
24
|
+
|
|
25
|
+
Am I heading in the correct direction? --Bil
|
|
26
|
+
|
|
27
|
+
Yes. comments:
|
|
28
|
+
# You don't need to escape the file-names, Soks should detect they are not escaped and correct them.
|
|
29
|
+
# You don't need to create revisions files, Soks will create them automatically.
|
|
30
|
+
# If a revision file exists, but is out of date, Soks will bring the revision file up to date.
|
|
31
|
+
# (I think you have realised this, but just in case) To import the PDFs, you need to both put them in the attachment directory and create a page in the content directory whose name starts 'attached ' and whose content is @/attachment/filenameof.pdf@
|
|
32
|
+
# You can do this while the wiki is running (soks periodically scans the content folder and updates itself with any changes[1]) but if you are adding a lot of files it is best to stop the wiki while the changes are made.
|
|
33
|
+
-- tamc2
|
|
34
|
+
|
|
35
|
+
An alternative (only appropriate if you plan to update the wiki from the database frequently) would be to write a helper class that you call from start.rb and that uses the @wiki.revise(pagename, content, author) methods.
|
|
36
|
+
|
|
37
|
+
A third alternative would be to use DRb (e.g. write @require 'drb'@ @DRb.start_service( 'druby://localhost:9001', view)@ somewhere in your start.rb file) and then write a script (or use irb) to remotely call the @wiki.revise( pagename, content, author) methods.
|
|
38
|
+
|
|
39
|
+
fn1. Changes detected by looking at the file's timestamp, not its content.
|
|
40
|
+
|
|
41
|
+
Tag: Include this page in the distribution
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
h1. How to install Soks
|
|
2
|
+
|
|
3
|
+
h2. Requirements
|
|
4
|
+
|
|
5
|
+
# Essential: Ruby 1.8.2 from http://www.ruby-lang.org/en/
|
|
6
|
+
# Preferred: Ruby Gems from http://rubyforge.org/projects/rubygems/
|
|
7
|
+
|
|
8
|
+
h2. The easy install
|
|
9
|
+
|
|
10
|
+
If you have ruby gems, type:
|
|
11
|
+
|
|
12
|
+
@gem install Soks@
|
|
13
|
+
|
|
14
|
+
then
|
|
15
|
+
|
|
16
|
+
@soks-create-wiki.rb@ (Gems should have installed this in your path so you can type it anywhere, if it hasn't, look in your ruby library under @gems/Soks-X.X.X/bin/@ )
|
|
17
|
+
|
|
18
|
+
...and then surf to http://localhost:8000
|
|
19
|
+
|
|
20
|
+
h2. The harder install
|
|
21
|
+
|
|
22
|
+
Download the latest version of Soks from http://rubyforge.org/frs/?group_id=481
|
|
23
|
+
|
|
24
|
+
<pre>
|
|
25
|
+
<code>
|
|
26
|
+
tar -xvzf Soks-x.x.x.tgz
|
|
27
|
+
ruby Soks-x.x.x/bin/soks-create-wiki.rb
|
|
28
|
+
</code>
|
|
29
|
+
</pre>
|
|
30
|
+
|
|
31
|
+
...and then surf to http://localhost:8000
|
|
32
|
+
|
|
33
|
+
Tag: Include this page in the distribution
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
h1. How to password protect your wiki
|
|
2
|
+
|
|
3
|
+
You can specify what authentication to be used based on a regular expression match against the url used to access the page.
|
|
4
|
+
|
|
5
|
+
Open @start.rb@ in your wiki directory. Un-comment and edit the authenticators section and edit the array. The format is [ [ first regexp to match against title, authenticator to use ], [ second regexp to match against title, authenticator to use ] ... ]. For example:
|
|
6
|
+
|
|
7
|
+
h2. No authentication
|
|
8
|
+
|
|
9
|
+
The following matches against all the standard 'non editing commands' and doesn't ask for any authentication:
|
|
10
|
+
|
|
11
|
+
<code>[ %r{/(view|rss|print|find|meta)/.*}, WEBrick::HTTPAuth::NoAuthenticationRequired.new ]</code>
|
|
12
|
+
|
|
13
|
+
h2. No uploads
|
|
14
|
+
|
|
15
|
+
The following doesn't permit any file or picture uploads:
|
|
16
|
+
|
|
17
|
+
<code>[ %r{/upload/.*}, WEBrick::HTTPAuth::NotPermitted.new ]</code>
|
|
18
|
+
|
|
19
|
+
h2. Site wide password
|
|
20
|
+
|
|
21
|
+
The following asks for a site wide password to edit or save changes to the home page:
|
|
22
|
+
|
|
23
|
+
<code>[ %r{/(edit|save)/home page}, WEBrick::HTTPAuth::SiteWidePassword.new('password','You need to enter the site wide password to edit the home page') ]</code>
|
|
24
|
+
|
|
25
|
+
h2. Per-user passwords
|
|
26
|
+
|
|
27
|
+
The following uses the standard WEBrick authentication system on any page whose name starts with private. The standard WEBrick authentication uses a database of usernames and passwords. See [[ Gnome's Guide => http://shogo.homelinux.org/~ysantoso/webrickguide/html/html_webrick.html ]] for details.
|
|
28
|
+
|
|
29
|
+
<code>[ %r{/(view|edit|save)/private.*},WEBrick::HTTPAuth::BasicAuth.new( :UserDB => htpasswd, :Realm => realm ) ]</code>
|
|
30
|
+
|
|
31
|
+
The following is the default. For any page it just asks for a username, but the password can be left blank.
|
|
32
|
+
|
|
33
|
+
<code>[ %r{.*}, WEBrick::HTTPAuth::AskForUserName.new( 'No password, just enter a name') ]</code>
|
|
34
|
+
BasicAuth isn't very secure as it transfers passwords over plaintext. If you can cope with some incompatability with very old browsers, DigestAuth is more secure. To implement DigestAuth:
|
|
35
|
+
|
|
36
|
+
# run this command: @htdigest -c /path/to/your/soks-wiki/htdigest "name of your realm" yourusername@ and enter your password. On gentoo, the full path is @/usr/sbin/htdigest2@
|
|
37
|
+
# Add this line into start.rb, inside the authenticators= block: @[ %r{/(view|edit|save)/private.*},WEBrick::HTTPAuth::DigestAuth.new( :UserDB => WEBrick::HTTPAuth::Htdigest.new('/path/to/your/soks-wiki/htdigest'), :Realm => "name of your realm") ]@
|
|
38
|
+
|
|
39
|
+
h2. Multiple authentication systems
|
|
40
|
+
|
|
41
|
+
To further-complicate your login woes, there is a nifty trick you can pull with the way Soks does its authentications. Because it creates a separate instance of the authenticator for each regexp, you can stack 'em :) Say you want to restrict viewing to those who have an account, but you don't want everyone to be able to edit. The first step is to create two htdigest files. One will have those who can read, the other those who can write. When you make these files, ensure that the realms are identical. Now assign the htdigest.write to the (edit|save) bits, and the htdigest.read to the (view|print|etc) bits. The annoying bit is that users who can edit need to be added to both files, but it makes up for it by users not having to login again when they want to edit.
|
|
42
|
+
|
|
43
|
+
----
|
|
44
|
+
|
|
45
|
+
h2. Suggestions / The future
|
|
46
|
+
|
|
47
|
+
Is there any means to changing the authentication on the fly like how the editable "sidebar page" works? (Have a "master" page that is access controlled, on which one would put other page links that would then become access controlled.) --Bil
|
|
48
|
+
|
|
49
|
+
Can someone point me to an example (or outline the steps) to having the user names checked for validity by an LDAP server ? (Note: I asked a similar question on the Webricken mailing list.) --Bil
|
|
50
|
+
|
|
51
|
+
Not used LDAP myself, but the example at http://dataspill.org/posts/show/4 seems to show how one might communicate with the LDAP server to check valididty. This would need to be inserted into a WEBrick authenticator. If you just duplicate the code of an existing WEBrick authenticator (e.g. 1.8/webrick/httpauth/basicath.rb) you should be able to do a few tweaks to the authenticate method to get what you want. --tamc2
|
|
52
|
+
|
|
53
|
+
Tag: Include this page in the distribution
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
h1. How to re-build the page cache
|
|
2
|
+
|
|
3
|
+
If you upgrade, or something goes wrong, or you just delete the contents of the cache directory in your wiki, then it will be rebuilt automatically. Unfortunately this can take quite a long time for very large wikis (I have a 4,500 page wiki). I will try and improve this in a future version of soks, but in the mean time, you can write yourself a small script to rebuild the cache by duplicating the start.rb script in your wiki folder and modifying it to be something like this.
|
|
4
|
+
|
|
5
|
+
<pre>
|
|
6
|
+
<code>
|
|
7
|
+
#!/usr/local/bin/ruby
|
|
8
|
+
|
|
9
|
+
# This file is to rebuild the cache. Don't blindly copy, but make your start.rb look like this.
|
|
10
|
+
|
|
11
|
+
$LOG = Logger.new(STDOUT)
|
|
12
|
+
$LOG.level = Logger::DEBUG
|
|
13
|
+
$LOG.datetime_format = "%Y-%m-%d %H:%M:%S"
|
|
14
|
+
|
|
15
|
+
#Add the required libraries to the search path
|
|
16
|
+
begin
|
|
17
|
+
require 'rubygems'
|
|
18
|
+
require_gem 'Soks', '~> 1.0.0'
|
|
19
|
+
$LOG.info 'Loaded Soks 1.0.0 from gem'
|
|
20
|
+
rescue LoadError
|
|
21
|
+
$LOG.info "Soks Gem version 1.0.0 could not be found"
|
|
22
|
+
$:.push( "/usr/lib/ruby/gems/1.8/gems/Soks-1.0.0/lib","/usr/lib/ruby/gems/1.8/gems/Soks-1.0.0/lib/helpers","/usr/lib/ruby/gems/1.8/gems/Soks-1.0.0//contrib" )
|
|
23
|
+
require 'soks'
|
|
24
|
+
$LOG.info 'Loaded Soks libraries from /usr/lib/ruby/gems/1.8/gems/Soks-1.0.0/lib","/usr/lib/ruby/gems/1.8/gems/Soks-1.0.0/lib/helpers","/usr/lib/ruby/gems/1.8/gems/Soks-1.0.0//contrib'
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
root_directory = File.expand_path( File.dirname( __FILE__) )
|
|
28
|
+
$MESSAGES = YAML.load( IO.readlines("#{root_directory}/views/messages.yaml").join )
|
|
29
|
+
banned_titles = IO.readlines("#{root_directory}/banned_titles.txt").map { |title| title.strip }
|
|
30
|
+
|
|
31
|
+
module Notify
|
|
32
|
+
def notify( event, *messages)
|
|
33
|
+
#raise "Sorry! Shutting down..." if @shutting_down
|
|
34
|
+
#self.event_queue.event( event, messages )
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
class View
|
|
39
|
+
def shutdown
|
|
40
|
+
@wiki.save_cache(REDCLOTH_CACHE_NAME,@redcloth_cache)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
wiki = Wiki.new( "#{root_directory}/content", "#{root_directory}/caches" )
|
|
45
|
+
wiki.load_all_pages
|
|
46
|
+
wiki.shutdown
|
|
47
|
+
$LOG.info "Written page cache"
|
|
48
|
+
|
|
49
|
+
view = View.new( wiki, "http://localhost:9999", "#{root_directory}/views" )
|
|
50
|
+
view.name = 'A Soks Wiki'
|
|
51
|
+
view.description = 'A Soks Wiki for you!'
|
|
52
|
+
view.reload_erb_each_request = false
|
|
53
|
+
view.dont_frame_views = ['print','rss','listrss','linksfromrss']
|
|
54
|
+
view.redcloth_hard_breaks = false
|
|
55
|
+
view.author_to_email_conversion = '@address-not-known.com'
|
|
56
|
+
|
|
57
|
+
wiki.each do |pagename, page|
|
|
58
|
+
view.rollingmatch[ page.name ] = page
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
wiki.each do |pagename, page|
|
|
62
|
+
view.redcloth( page )
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
wiki.shutdown
|
|
66
|
+
view.shutdown
|
|
67
|
+
$LOG.info "Written view cache"
|
|
68
|
+
</code>
|
|
69
|
+
</pre>
|
|
70
|
+
|
|
71
|
+
Tag: Include this page in the distribution
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
h1. How to report a bug
|
|
2
|
+
|
|
3
|
+
I really appreciate bug reports.
|
|
4
|
+
|
|
5
|
+
Please click [[ here => http://www.soks.org/edit/BugTypeATitleHere ]] or go to http://www.soks.org and create a new page whose title starts with bug:, e.g. @bug: does not make tea@.
|
|
6
|
+
|
|
7
|
+
In that page, please give as much information as you can and leave some contact details.
|
|
8
|
+
|
|
9
|
+
Tag: Include this page in the distribution
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
h1. How to upgrade
|
|
2
|
+
|
|
3
|
+
First download the latest release of soks:
|
|
4
|
+
|
|
5
|
+
Preferably:
|
|
6
|
+
# Install rubygems from http://rubyforge.org/projects/rubygems/
|
|
7
|
+
# @gem update Soks@ (you may need to be root first)
|
|
8
|
+
|
|
9
|
+
Alternatively
|
|
10
|
+
# Download the tar or zip file from http://rubyforge.org/projects/soks/
|
|
11
|
+
# Unzip or untar it
|
|
12
|
+
# Change into the soks directory
|
|
13
|
+
|
|
14
|
+
h2. This will always work...
|
|
15
|
+
|
|
16
|
+
Then execute the command.
|
|
17
|
+
|
|
18
|
+
# @soks-create-wiki.rb --destination-dir=path/to/your/wiki@ and it will guide you through the upgrade.
|
|
19
|
+
|
|
20
|
+
If you haven't touched your start.rb file, then you are good to go. Otherwise you will need to edit the new start.rb file in your wiki to your tastes, the way this is set up changed substantially in v1-0-0, but it should be clear enough.
|
|
21
|
+
|
|
22
|
+
Should anything go wrong, or you need to revert, a pristine copy of your wiki is created in YourWikiName-bak-0.
|
|
23
|
+
|
|
24
|
+
h2. But this is quicker if it is only a minor upgrade
|
|
25
|
+
|
|
26
|
+
If your wiki is v1-0-0 or above then I have changed the version numbering system, so that if the version you wish to upgrade to only changes the last digit, you don't need to go through the full upgrade.
|
|
27
|
+
|
|
28
|
+
If you use gems, then your wiki should automatically use the new version next time you start it. Otherwise edit start.rb in your wiki to point to the new version of soks that you downloaded.
|
|
29
|
+
|
|
30
|
+
Note that I may make minor improvements to the way the wiki looks, which will not appear in your wiki if you follow this method. If you want to make sure they do, copy the contents of the soks/templates/default/views directory to your soks-wiki/views directory.
|
|
31
|
+
|
|
32
|
+
Tag: Include this page in the distribution
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
h1. Automatic Helpers
|
|
2
|
+
|
|
3
|
+
Soks has a range of helper classes:
|
|
4
|
+
* Automatic summaries - Scan for other wiki pages and create new pages that have lists of relevant pages (e.g. Known Bugs)
|
|
5
|
+
* Automatic counters - Watch for certain events and count them (e.g. most popular pages, most frequent visitor, most prolific author)
|
|
6
|
+
* Automatic importers - Look outside the wiki and do things like mirroring rss feeds, or the contents of an e-mail folder
|
|
7
|
+
* Automatic maintenance helpers - Prune old revisions, merge others, permanently remove deleted pages etc.
|
|
8
|
+
* Automatic exporters - Take data from the wiki and put it elsewhere.
|
|
9
|
+
|
|
10
|
+
The api for classes to modify the wiki is pretty simple, so you should be able to create what you want pretty quickly.
|
|
11
|
+
|
|
12
|
+
Tag: Include this page in the distribution
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
h1. Pointers on how to use this wiki
|
|
2
|
+
|
|
3
|
+
h2. Adding Pages
|
|
4
|
+
|
|
5
|
+
There are several ways to add pages to soks:
|
|
6
|
+
# Click on the 'add a new page'
|
|
7
|
+
# Highlight the text on the page you wish to link from and press crtl-n[1]
|
|
8
|
+
# Type the title of the page you wish to create and click search, there will be a link to create the page at the bottom of the search results.
|
|
9
|
+
# As you are editing a page, put the title of a new page in square brackets like this: <notextile>[[ title of the new page ]]</notextile>. When you save the page, a link will be created that permits you to create a new page.
|
|
10
|
+
|
|
11
|
+
Yes, this means it is very easy to create orphaned pages. No I don't think this is a problem, because there is a site index.
|
|
12
|
+
|
|
13
|
+
fn1. This only works on some browsers. It doesn't seem to work on Mac Firefox or Mac OmniWeb. It does on Mac Safari. Please report your successes and failures.
|
|
14
|
+
|
|
15
|
+
h2. Editing Pages
|
|
16
|
+
|
|
17
|
+
* To edit a page, click edit this page at the bottom of the page.
|
|
18
|
+
* The pages are written in textile. A reference is at http://hobix.com/textile/quick.html
|
|
19
|
+
* Links to other pages within this wiki, and to web addresses, and to e-mail addresses, happen automatically
|
|
20
|
+
* To force a link put it inside double square brackets e.g. <notextile>[[a forced link]]</notextile>
|
|
21
|
+
* To alias a link: <notextile> [[ a different name for </notextile>=><notextile> site index ]] </notextile>
|
|
22
|
+
* To insert another page: <notextile>[ [ insert site index ]]</notextile>
|
|
23
|
+
* This is particularly usefull if you want to insert a picture: <notextile>[ [ insert picture of the soks logo ]]</notextile>
|
|
24
|
+
* It can also be usefull to save one step in directing people to download an attached file: <notextile>[ [ insert attached file to download ]]</notextile>.
|
|
25
|
+
|
|
26
|
+
h2. Searching
|
|
27
|
+
|
|
28
|
+
The search box on the right takes a single regular expression.
|
|
29
|
+
|
|
30
|
+
Tag: Include this page in the distribution
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
h1. List of changes
|
|
2
|
+
|
|
3
|
+
There are three list of changes pages, all created automatically from submissions to the darcs repository:
|
|
4
|
+
# Changes to soks-stable contains the changes that actually make it to a release.
|
|
5
|
+
# Changes to soks-testing gives a flavour of what (might) be coming in the next couple of releases.
|
|
6
|
+
# Changes to soks-development gives a sense of experiments with the code, some of which might make it to a release.
|
|
7
|
+
|
|
8
|
+
If you wish to see changes from before the switch to darcs (i.e. version 1.0.1 and before) please see the list of changes for older versions.
|
|
9
|
+
|
|
10
|
+
Tag: Include this page in the distribution
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
h1. Version 1-0-0 released
|
|
2
|
+
|
|
3
|
+
It gives me great pleasure to announce the sixth public release of Soks as v1-0-0. There have been a lot of changes, and much of Soks has now stabalised so I've decided to call it a beta rather than an alpha. When I iron out a few more bugs I might even be confident in calling it stable.
|
|
4
|
+
|
|
5
|
+
See how to install soks, or how to upgrade soks for instructions. There is a full list of list of changes and some known bugs, but in brief:
|
|
6
|
+
|
|
7
|
+
* Page titles can now have any punctuation, and the wiki urls look slightly prettier.
|
|
8
|
+
* Two new RSS feeds, one of which contains all the pages linked to from a particular page, the other that includes edits made to the contents of linked pages. These are both useful in conjunction with the automatic summary classes.
|
|
9
|
+
* Some popular pages, authors, visitors counters (not enabled by default)
|
|
10
|
+
* The wiki can now save cache of page data and views when the wiki is shutdown. This makes starting the wiki again much faster.
|
|
11
|
+
* The way that all the settings are made has completely changed, hopefully to make it clearer, and to enable several wiki's to be mounted on the same Webrick server.
|
|
12
|
+
* Some maintenance helpers, that can periodically slim the wiki (these are not enabled by default)
|
|
13
|
+
* Can now include several static file handlers
|
|
14
|
+
|
|
15
|
+
There has also been quite a lot of refactoring and bug fixing, all though some (not critical) bugs remain. With the shift in version numbering, I plan to offer a 1-0-x series of releases as soon as I fix bugs until this release is thoroughly stable. I will add features to a 1-1-0 release.
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
Tag: Include this page in the distribution
|