Top Level Namespace

Defined Under Namespace

Modules: CLabs, ClWiki Classes: ClWikiConvertor, Cron, FormatBlockquote, FormatGraphVizDiGraph, FormatOPML, FormatPreBlockquote, FormatSimpleTable, PageDepth, String, TestSingleWikiPage

Constant Summary collapse

CLWIKI_PATH =

Copyright © 2001-2004, Chris Morris All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice,

this list of conditions and the following disclaimer.

  1. Redistributions in binary form must reproduce the above copyright

notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  1. Neither the names Chris Morris, cLabs nor the names of contributors to

this software may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


(based on BSD Open Source License)

"C:/Apache/Apache2/htdocs/clwiki/"
CLWIKI_URL =
'/clwiki/clwikicgi.rb'

Instance Method Summary collapse

Instance Method Details

#do_hitsObject



386
387
388
389
# File 'lib/cl_wiki/index.rb', line 386

def do_hits
  puts @i.hit_summary.inspect
  puts
end

#do_index_dumpObject



376
377
378
379
# File 'lib/cl_wiki/index.rb', line 376

def do_index_dump
  puts 'Dumping...'
  @i.dump
end

#do_page_exists(fullPageName) ⇒ Object



363
364
365
366
367
368
369
# File 'lib/cl_wiki/index.rb', line 363

def do_page_exists(fullPageName)
  if @i.page_exists?(fullPageName)
    puts fullPageName + ' exists'
  else
    puts fullPageName + ' does not exist'
  end
end

#do_recentObject



381
382
383
384
# File 'lib/cl_wiki/index.rb', line 381

def do_recent
  puts @i.recent
  puts
end

#do_search(search) ⇒ Object



371
372
373
374
# File 'lib/cl_wiki/index.rb', line 371

def do_search(search)
  puts @i.search(search).join("\n")
  puts
end

#do_sendmail(to, from, subj, body, msg_id) ⇒ Object



212
213
214
215
216
217
218
# File 'lib/cl_wiki/tools/cron.reminders.rb', line 212

def do_sendmail(to, from, subj, body, msg_id)
  smtp = MoSmtp.new
  smtp.subj = subj
  smtp.body = body
  smtp.extra_headers = ["In-Reply-To: #{msg_id}", "References: #{msg_id}"]
  smtp.sendmail
end

#launch_server(port = nil, fn = nil) ⇒ Object



354
355
356
357
358
359
360
# File 'lib/cl_wiki/index.rb', line 354

def launch_server(port=nil, fn=nil)
  port = ClWiki::Indexer.defaultPort if !port
  idxServer = ClWiki::Indexer.new(fn)
  puts "ClWikiIndexer launching on localhost:#{port}..."
  DRb.start_service("druby://localhost:#{port}", idxServer)
  DRb.thread.join
end

#read_page(pageName) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/cl_wiki/tools/singlepage.rb', line 8

def read_page(pageName)
  content = ''
  @stack.push PageDepth.new(pageName, 0)
  while !@stack.empty?
    pageDepth = @stack.shift
    @depth = pageDepth.depth
    pageName = pageDepth.name

    if @depth <= @depthLimit
      content << "\n" + pageName + "\n" + ("=" * pageName.length) + "\n"
      page = ClWikiPage.new(pageName, @wikiPath)
      page.read_raw_content
      formatter = ClWikiPageFormatter.new(page.raw_content, pageName)
      content << formatter.formatLinks do |word|
        if formatter.isWikiName?(word)
          wikiPageName = word
          wikiPageName = '/' + wikiPageName if wikiPageName[0..0] != '/'
          if !@visited.include?(wikiPageName)
            @visited << wikiPageName
            @stack.push PageDepth.new(wikiPageName, @depth + 1)
          end
          wikiPageName
        else
          word
        end
      end
      content << "\n"
    end
    @stack.delete_if { |pgd| pgd.name =~ /journal/i }
  end
  content
end

#show_helpObject



391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
# File 'lib/cl_wiki/index.rb', line 391

def show_help
  puts 'ClWikiIndexer'
  puts
  puts '-h        Show this help'
  puts
  puts '-s        Launch drb server'
  puts "-p        Drb port. Default is #{ClWiki::Indexer.defaultPort}"
  puts '-f [fn]   File to route output to. stdout used if not specified'
  puts '-b        Do a full re-build of the index'
  puts '-bp       Do a full re-build, purging unused pages. An unused page'
  puts '          is one where the contents are the default content after'
  puts '          creation, but has never been edited.'
  puts '-l [x]    If -b, limit number of pages built to x'
  puts '<none>    load index to search for terms entered in stdin'
  puts '-q [term] load index and search for term'
  puts '-r [page] load index and see if page exists'
  puts '-x [page] load index and re-index the specified page'
  puts '-d        debug'
  puts '-dump     dumps full index to text file'
  puts '-recent   show 1st recent hits'
  puts '-hits     show 1st hit count'
end