Extracted storage of files functionality from controller to an object called FileYard.

There is one file yard per web.
This commit is contained in:
Alexey Verkhovsky 2005-01-23 01:36:51 +00:00
parent 0d81292168
commit 1d82582c3b
7 changed files with 112 additions and 54 deletions

View file

@ -7,6 +7,7 @@ require 'madeleine/zmarshal'
require 'web'
require 'page'
require 'author'
require 'file_yard'
module AbstractWikiService
@ -24,6 +25,12 @@ module AbstractWikiService
@webs[address] = nil
end
def file_yard(web)
raise "Web #{@web.name} does not belong to this wiki service" unless @webs.values.include?(web)
# TODO cache FileYards
FileYard.new("#{self.storage_path}/#{web.address}")
end
def init_wiki_service
@webs = {}
@system = {}
@ -110,7 +117,7 @@ class WikiService
# These methods do not change the state of persistent objects, and
# should not be ogged by Madeleine
automatic_read_only :authenticate, :read_page, :setup?, :webs, :storage_path
automatic_read_only :authenticate, :read_page, :setup?, :webs, :storage_path, :file_yard
@@storage_path = './storage/'