Sha256: 4fc2e3eb9f99948edc4ecab6c156e752c7387883540634e3690df3f2195d39f6
Contents?: true
Size: 939 Bytes
Versions: 2
Compression:
Stored size: 939 Bytes
Contents
module Rpub module CompilationHelpers def create_book book = Book.new(layout, config) markdown_files.each(&book.method(:<<)) book end def markdown_files @markdown_files ||= filter_exceptions(Dir['*.md']).sort.map(&File.method(:read)) end def layout @layout ||= own_or_support_file('layout.html') end def styles @styles ||= own_or_support_file('styles.css') end def config @config_file ||= begin raise NoConfiguration unless File.exist?('config.yml') YAML.load_file('config.yml') || {} end end private def filter_exceptions(filenames) return filenames unless config.has_key?('ignore') filenames.reject(&config['ignore'].method(:include?)) end def own_or_support_file(filename) if File.exists?(filename) filename else Rpub.support_file(filename) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rpub-0.2.0 | lib/rpub/compilation_helpers.rb |
rpub-0.1.0 | lib/rpub/compilation_helpers.rb |