Sha256: 0d7434de7bf05ff4d2574a5f1c3ae821cf46b888b30e28f5bf090c1690e91668
Contents?: true
Size: 1.35 KB
Versions: 1
Compression:
Stored size: 1.35 KB
Contents
require 'fileutils' module Staticpress class Site # ordered by priority CONTENT_TYPES = [ Staticpress::Content::Page, Staticpress::Content::Post, Staticpress::Content::Index, Staticpress::Content::Category, Staticpress::Content::Tag, Staticpress::Content::Theme ] include Enumerable include Staticpress::Helpers attr_reader :directory def initialize @directory = Staticpress.blog_path + config.source_path end def each(&block) semaphore = Mutex.new CONTENT_TYPES.map do |content_type| Thread.new do content_type.published.each do |content| semaphore.synchronize do block.call content end end end end.each(&:join) end def find_content_by_env(env) catch :content do CONTENT_TYPES.detect do |content_type| content = content_type.find_by_url_path env['REQUEST_PATH'] throw :content, content if content && content.exist? end nil end end def meta # or something... inject(Staticpress::Metadata.new) { |meta, content| meta << content.meta } end def save destination = Staticpress.blog_path + config.destination_path FileUtils.rm_r destination if destination.directory? each &:save end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
staticpress-0.7.1 | lib/staticpress/site.rb |