Sha256: 3099f60326725dd6be484de8d9ea8445727317e11c20db735c1b536abc7bd0e6

Contents?: true

Size: 1.51 KB

Versions: 1

Compression:

Stored size: 1.51 KB

Contents

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bookshelf-1.0.0 lib/bookshelf.rb