class Staticpress::Site
Constants
- CONTENT_TYPES
ordered by priority
Attributes
directory[R]
Public Class Methods
new()
click to toggle source
# File lib/staticpress/site.rb, line 20 def initialize @directory = Staticpress.blog_path + config.source_path end
Public Instance Methods
each(&block)
click to toggle source
# File lib/staticpress/site.rb, line 24 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
find_content_by_env(env)
click to toggle source
# File lib/staticpress/site.rb, line 38 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
meta()
click to toggle source
# File lib/staticpress/site.rb, line 49 def meta # or something... inject(Staticpress::Metadata.new) { |meta, content| meta << content.meta } end
save()
click to toggle source
# File lib/staticpress/site.rb, line 54 def save destination = Staticpress.blog_path + config.destination_path FileUtils.rm_r destination if destination.directory? each &:save end