#!/usr/local/bin/ruby # This file was created automatically on <%= Time.now %> # Uncomment different sections to enable features of this wiki. #Add the required libraries to the search path: $:.push( "<%= settings[:soks_libraries].join('","') %>" ) require 'soks' module StartSoks =begin # If you uncomment this, don't forget to uncomment the authenticators line in the CUSTOMSETTINGS hash below! # You can choose what level of authentication to apply based on regular expressions matched # against the page title. These regexps are tried in order.Defaults are here: authenticators = [ [ %r{/(view|rss|print|find|meta)/.*}, WEBrick::HTTPAuth::NoAuthenticationRequired.new ], # [ %r{/upload/.*}, WEBrick::HTTPAuth::NotPermitted.new ], # [ %r{/(edit|save)/home page}, WEBrick::HTTPAuth::SiteWidePassword.new('password','You need to enter the site wide password to edit the home page') ], # [ %r{/(view|edit|save)/private.*},WEBrick::HTTPAuth::BasicAuth.new( :UserDB => htpasswd, :Realm => realm ) ], # See webrick documentation [ %r{.*}, WEBrick::HTTPAuth::AskForUserName.new( 'No password, just enter a name') ] ] =end CUSTOMSETTINGS = { :root_directory => '<%= settings[:root_directory] %>', # :name => 'test', # :description => 'A Soks Wiki', :url => '<%= settings[:url] %>', :port => <%= settings[:port] %>, # :authenticators => authenticators } def self.start start_wiki( CUSTOMSETTINGS ) do |wiki, view| AutomaticRecentChanges.new( wiki ) AutomaticOnePageIndex.new( wiki ) # Index on one page, best for small wikis # AutomaticMultiPageIndex.new( wiki ) # One page per letter index, best for large wikis # calendar = AutomaticCalendar.new( wiki ) # Adds a series of calendar pages to the wiki # AutomaticUpcomingEvents.new( wiki, calendar ) # Creates a page with the next weeks events drawn from the calendar pages # Examples of automatically generated summary pages: AutomaticSummary.new( wiki, :regexp_for_title => /^How to /i, :pagename => 'Instructions and Howtos' ) AutomaticSummary.new( wiki, :regexp_for_title => /^Bug:/i, :pagename => 'Known bugs', :include_metadata => true ) AutomaticSummary.new( wiki, :regexp_for_title => /^Blog:/i, :max_pages_to_show => 10, :lines_to_include => 10, :include_metadata => true, :pagename => 'Recent Blog Entries' ) # Possible settings for the Automatic Summary (with defaults) # :regexp_for_title => /.*/, # These three regexps act as an AND # :regexp_for_author => nil, # :regexp_for_content => nil, # :max_pages_to_show => nil, # :pagename => 'Summary', # :author => 'AutomaticSummary', # :lines_to_include => nil, # nil puts a link, can pass a block instead to render # :only_new_pages => false, # :sort_pages_by => :created_on, # Could be :revised_on or :score or :name or :name_for_index, or :author # :reverse_sort => false, # :include_metadata => false, # Includes author and time in summary # :summarise_revisions => false, # If true, then can contain several revisions for same page # :remove_deleted_pages => true, # If false will keep references to deleted pages # This is an array of titles that will NOT be automatically linked. # Default is the 30 most common words in the english language # Note that pages can still be created with these titles, and they can still be manually linked to. banned_titles = IO.readlines('<%= settings[:root_directory] %>/banned_titles.txt').map { |title| title.strip } # This takes a while, so do it last. Note that the banned_titles argument is optional. AutomaticUpdateCrossLinks.new( wiki, view, banned_titles ) end end end if $0 == __FILE__ then StartSoks::start end