Method: Monograph::CLI#build

Defined in:
lib/monograph/cli.rb

#build(destination = nil, source = nil) ⇒ Object

Export a book, assuming we’re in the root of it

Raises:



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/monograph/cli.rb', line 17

def build(destination = nil, source = nil)
  source = Dir.pwd if source.nil?
  destination = File.join(source, 'build') if destination.nil?
  raise Error, "You are not currently within a Monograph root" unless File.exist?(File.join(source, 'config.yml'))
  FileUtils.rm_rf(destination)
  book = Book.new(source)
  book.export.save(destination)
  puts
  puts " Saved build to #{destination}."
  puts " Open your cover page at file://#{File.expand_path(destination)}/index.html"
  puts
  book
end