12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/burr/cli.rb', line 12
def export(format)
valid = %w(site pdf epub mobi all)
if valid.include?(format)
book = Burr::Book.new(config, format)
case format
when 'site'
book.export_site
when 'pdf'
unless Dependency.prince_installed?
book.ui.warn "Please install PrinceXML first."
exit 1
end
book.export_pdf
when 'epub'
book.export_epub
when 'mobi'
unless Dependency.kindlegen_installed?
book.ui.warn "Please install kindelgen first."
exit 1
end
book.export_mobi
when 'all'
puts 'pending'
end
else
raise "ERROR: invalid format. Formats: #{valid.join(', ')}."
end
end
|