Sha256: 3c29fd7d170a2a80e301d39dd2dc624a4b47326046993c917ba08f27c089d8f6
Contents?: true
Size: 807 Bytes
Versions: 1
Compression:
Stored size: 807 Bytes
Contents
# The minimal _why wiki in Innate with ERB %w[rubygems innate erb maruku yaml/store].each{|l| require(l) } DB = YAML::Store.new('wiki.yaml') unless defined?(DB) class Wiki Innate.node '/' layout 'wiki' engine :ERB def index(page = 'Home') @page = page @text = 'foo' sync{ @text = DB[page].to_s.dup @text.gsub!(/\[\[(.*?)\]\]/) do %(<a href="#{r($1)}" class="#{DB[$1] ? 'exists' : 'missing'}">#{h($1)}</a>) end } end def edit(page) @page = page @text = sync{ DB[page].to_s } end def save page, text = request[:page, :text] sync{ DB[page] = text } if request.post? and page and text redirect(r(page)) end private def sync Innate::STATE.sync{ DB.transaction{ yield }} end end Innate.start :adapter => :mongrel
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
manveru-innate-2009.04.08 | example/app/whywiki_erb/start.rb |