Module: Rpub::CompilationHelpers

Included in:
Rpub::Commands::Clean, Rpub::Commands::Compile, Rpub::Commands::Package, Rpub::Commands::Preview
Defined in:
lib/rpub/compilation_helpers.rb

Instance Method Summary collapse

Instance Method Details

#configObject



21
22
23
24
25
26
# File 'lib/rpub/compilation_helpers.rb', line 21

def config
  @config_file ||= begin
    raise NoConfiguration unless File.exist?('config.yml')
    YAML.load_file('config.yml') || {}
  end
end

#create_bookObject



3
4
5
6
7
# File 'lib/rpub/compilation_helpers.rb', line 3

def create_book
  book = Book.new(layout, config)
  markdown_files.each(&book.method(:<<))
  book
end

#layoutObject



13
14
15
# File 'lib/rpub/compilation_helpers.rb', line 13

def layout
  @layout ||= own_or_support_file('layout.html')
end

#markdown_filesObject



9
10
11
# File 'lib/rpub/compilation_helpers.rb', line 9

def markdown_files
  @markdown_files ||= filter_exceptions(Dir['*.md']).sort.map(&File.method(:read))
end

#stylesObject



17
18
19
# File 'lib/rpub/compilation_helpers.rb', line 17

def styles
  @styles ||= own_or_support_file('styles.css')
end