module Marsdawn

Constants

VERSION

Public Class Methods

build(*keys) { |conf| ... } click to toggle source

build document source @param [String] key of config file entry

# File lib/marsdawn.rb, line 22
def self.build *keys
  require "marsdawn/builder"
  if block_given?
    conf = {}
    yield conf
    configs = [conf]
  else
    configs = configs_from_file(keys)
  end
  configs.each do |conf|
    Marsdawn::Builder.build conf
  end
  puts "[MarsDawn] Build complete."
rescue => e
  puts "[MarsDawn] ERROR: #{e.message}"
end
require_lib(path) click to toggle source

load lib file from lib/marsdawn directory @param [String] require file under lib/marsdawn directory

# File lib/marsdawn.rb, line 15
def self.require_lib path
  @@base_path ||= File.expand_path(File.join(File.dirname(__FILE__), 'marsdawn'))
  require File.join(@@base_path, path)
end

Private Class Methods

configs_from_file(keys) click to toggle source
# File lib/marsdawn.rb, line 40
def self.configs_from_file keys
  [].tap do |ret|
    config = Marsdawn::Config.new
    if keys.size > 0
      keys.each do |key|
        ret << config.to_hash(key)
      end
    else
      config.each do |key, conf|
        ret << conf
      end
    end
  end
end