Sha256: 47ff8a1a649802bc3e392d2b1e9353b681c91aa6b62f2c867e33e822ae21f4e2

Contents?: true

Size: 1.67 KB

Versions: 7

Compression:

Stored size: 1.67 KB

Contents

# Copyright (C) 2003-2006 Kouichirou Eto, All rights reserved.
# This is free software with ABSOLUTELY NO WARRANTY.
# You can redistribute it and/or modify it under the terms of the GNU GPL 2.

require 'time'
require 'fileutils'

$LOAD_PATH.unshift '..' unless $LOAD_PATH.include? '..'
require 'qwik/server-memory'
require 'qwik/pages'
require 'qwik/site-config'
require 'qwik/site-log'
require 'qwik/site-member'
require 'qwik/site-url'
require 'qwik/site-pages'
require 'qwik/site-group'
require 'qwik/site-files'
#require 'qwik/site-rrefs'
#require 'qwik/site-search'

module Qwik
  class Site
    include Enumerable

    CACHE_DIR = '.cache'

    def initialize(config, memory, sitename)
      @config = config
      @memory = memory

      @sitename = sitename
      @path = "#{@config.sites_dir}/#{sitename}".path
      @pages = Pages.new(@config, @path)

      @cache_path = @path + CACHE_DIR
      @cache_path.check_directory

      @cache = {}

      init_group_config		# site-group.rb

#      init_site_search
    end
    attr_reader :sitename
    attr_reader :path
    attr_reader :cache_path
    attr_reader :cache

    def inspect
      return "#<Site:#{@sitename}>"
    end
  end
end

if $0 == __FILE__
  require 'qwik/test-module-session'
  require 'qwik/farm'
  $test = true
end

if defined?($test) && $test
  class TestSite < Test::Unit::TestCase
    include TestSession

    def test_all
      sitename = 'site_test'
      pa = @config.sites_dir.path + sitename
      pa.rmtree if pa.exist?
      pa.mkdir
      assert_equal false, (pa+sitename).exist?
      site = Qwik::Site.new(@config, @memory, sitename)
      assert_equal false, (pa+sitename).exist?
      pa.rmtree
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
qwik2md-2.0.1 vendor/qwik/lib/qwik/site.rb
qwik2md-2.0.0 vendor/qwik/lib/qwik/site.rb
qwik2md-1.0.2 vendor/qwik/lib/qwik/site.rb
qwik2md-1.0.1 vendor/qwik/lib/qwik/site.rb
qwik2md-1.0.0 vendor/qwik/lib/qwik/site.rb
qwik2md-0.1.0 vendor/qwik/lib/qwik/site.rb
qwikdoc-0.0.1 vendor/qwik/site.rb