class Pars

Public Class Methods

anyPost?() click to toggle source
# File lib/pars.rb, line 15
def self.anyPost?
        if File.exist?(Dir.pwd + "/posts") then
                true
        else
                false
        end
end
directory_hash(path, name=nil) click to toggle source
# File lib/pars.rb, line 23
def self.directory_hash(path, name=nil)

  data = {:data => (name || path)}
  data[:children] = children = []

  Dir.foreach(path) do |entry|

    next if (entry == '..' || entry == '.')

    full_path = File.join(path, entry)

    if File.directory?(full_path)
      children << directory_hash(full_path, entry)
    else
      children << entry
    end
  end

  return data
end
generate() click to toggle source
# File lib/pars.rb, line 44
def self.generate
        Dir.glob(Dir.pwd + "/posts/" + "*.md") do |doc|
                puts doc
        end           
end
isParsDir?() click to toggle source
# File lib/pars.rb, line 7
def self.isParsDir?
        if File.exist?(".pars.yml") then
                true
        else
                false
        end
end