Sha256: fa28c97339c7e4907971b94659bd9d182d67f5b9b26590ebb3f5ece7d1599b65

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

class RuneBlog
  VERSION = "0.0.30"

  Path  = File.expand_path(File.join(File.dirname(__FILE__)))
  DefaultData = Path + "/../data"

  BlogHeader  = File.read(DefaultData + "/custom/blog_header.html")  rescue "not found"
  BlogTrailer = File.read(DefaultData + "/custom/blog_trailer.html") rescue "not found"
end

class RuneBlog::Config
  attr_reader :root, :views, :view, :sequence

  def initialize(cfg_file = ".blog")
    # What views are there? Deployment, etc.
    # Crude - FIXME later
    new_blog! unless File.exist?(cfg_file)

    lines = File.readlines(cfg_file).map {|x| x.chomp }
    @root = lines[0]
    @view = lines[1]
    dirs = Dir.entries("#@root/views/") - %w[. ..]
    dirs.reject! {|x| ! File.directory?("#@root/views/#{x}") }
    @root = root
    @views = dirs
    @sequence = File.read(root + "/sequence").to_i
  end

  def next_sequence
    @sequence += 1
    File.open("#@root/sequence", "w") {|f| f.puts @sequence }
    @sequence
  end

  def viewdir(v)
    @root + "/views/#{v}/"
  end

end

require 'find'
require 'yaml'
require 'rubygems'
require 'ostruct'
require 'livetext'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
runeblog-0.0.30 lib/runeblog.rb