-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate
executable file
·37 lines (33 loc) · 1.15 KB
/
generate
1
2
3
4
5
6
7
8
9
10
11
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
#!/usr/bin/env ruby
require 'rubygems'
require 'bundler/setup'
Bundler.require(:default)
APP_ROOT = "#{__dir__}"
if ARGV.count == 1 && ['html', 'latex', 'pdf', 'epub', 'mobi'].include?(ARGV[0])
require "#{APP_ROOT}/app/lib/manuscript"
(compiler = TARGET.new(:default)).compile
if ARGV[0] == 'pdf'
puts %(
The Latex version of this book has been created. To finish
generating the PDF version of this book do following:
1. Make sure Latex (https://www.tug.org/texlive/) is
installed in your machine.
2. Run the following:
cd ./output
pdflatex -shell-escape #{compiler.config['output']}.tex
pdflatex -shell-escape #{compiler.config['output']}.tex\n\n)
elsif ARGV[0] == 'mobi'
puts %(
The EPUB version of this book has been created. To finish
generating the MOBI version of this book do following:
1. Download Amazon's KindleGen and add its kindlegen
command to you path.
2. Run the following:
cd ./output
kindlegen #{compiler.config['output']}.epub -o #{compiler.config['output']}.mobi\n\n)
else
puts "Done!"
end
else
puts "Nothing was done; invalid target. Valid targets are html, latex, pdf, epub, and mobi."
end