require "active_support/all" require "digest/md5" require "eeepub" require "erb" require "logger" require "nokogiri" require "notifier" require "open3" require "optparse" require "ostruct" require "RedCloth" require "tempfile" require "pathname" require "thor" require "thor/group" require "yaml" require "cgi" %w[maruku peg_markdown bluecloth redcarpet rdiscount].each do |lib| begin require lib break rescue LoadError => e next end end Encoding.default_internal = "utf-8" Encoding.default_external = "utf-8" module Bookshelf require "bookshelf/extensions/string" require "bookshelf/extensions/redcloth" require "bookshelf/errors" ROOT = Pathname.new(File.dirname(__FILE__) + "/..") autoload :Version, "bookshelf/version" autoload :Generator, "bookshelf/generator" autoload :TOC, "bookshelf/toc" autoload :Cli, "bookshelf/cli" autoload :Markdown, "bookshelf/adapters/markdown" autoload :Parser, "bookshelf/parser" autoload :Exporter, "bookshelf/exporter" autoload :Syntax, "bookshelf/syntax" autoload :Stream, "bookshelf/stream" autoload :Dependency, "bookshelf/dependency" autoload :Stats, "bookshelf/stats" def self.config(book_dir = nil) path = book_dir.join("config.yml") content = File.read(path) erb = ERB.new(content).result YAML.load(erb).with_indifferent_access end def self.logger @logger ||= Logger.new(File.open("/tmp/bookshelf.log", "a")) end def self.root_dir @root_dir ||= Pathname.new(Dir.pwd) end end