Module: Kitabu

Defined in:
lib/kitabu.rb,
lib/kitabu/cli.rb,
lib/kitabu/stats.rb,
lib/kitabu/errors.rb,
lib/kitabu/helpers.rb,
lib/kitabu/version.rb,
lib/kitabu/exporter.rb,
lib/kitabu/markdown.rb,
lib/kitabu/toc/epub.rb,
lib/kitabu/toc/html.rb,
lib/kitabu/generator.rb,
lib/kitabu/dependency.rb,
lib/kitabu/source_list.rb,
lib/kitabu/exporter/css.rb,
lib/kitabu/exporter/pdf.rb,
lib/kitabu/exporter/base.rb,
lib/kitabu/exporter/epub.rb,
lib/kitabu/exporter/html.rb,
lib/kitabu/exporter/mobi.rb,
lib/kitabu/footnotes/pdf.rb,
lib/kitabu/footnotes/base.rb,
lib/kitabu/footnotes/html.rb,
lib/kitabu/toc/html/stream.rb,
lib/kitabu/syntax/highlight.rb

Defined Under Namespace

Modules: Footnotes, Helpers, Markdown, TOC, Version Classes: Cli, Dependency, DirectoryAlreadyCreatedError, Exporter, Generator, SourceList, Stats, Syntax

Constant Summary collapse

ROOT =
Pathname.new("#{File.dirname(__FILE__)}/..")

Class Method Summary collapse

Class Method Details

.config(root_dir = nil) ⇒ Object



56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/kitabu.rb', line 56

def self.config(root_dir = nil)
  root_dir ||= Pathname.new(Dir.pwd)
  path = root_dir.join("config/kitabu.yml")

  unless File.file?(path)
    raise "Invalid Kitabu directory; couldn't find config/kitabu.yml file."
  end

  content = File.read(path)
  erb = ERB.new(content).result
  YAML.safe_load(erb).with_indifferent_access
end

.loggerObject



69
70
71
# File 'lib/kitabu.rb', line 69

def self.logger
  @logger ||= Logger.new(File.open("/tmp/kitabu.log", "a"))
end