-
Notifications
You must be signed in to change notification settings - Fork 59
/
Copy pathbuild_ebooks.sh
executable file
·46 lines (38 loc) · 1.24 KB
/
build_ebooks.sh
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
38
39
40
41
42
43
44
45
46
#Exit immediately if a command exits with a non-zero status.
# possible params to build with
## docapis
## writing_process
echo "Removing previous ebooks"
rm ebooks/docapis.mobi
rm ebooks/docapis.epub
rm ebooks/.DS_Store
echo "Done removing old ebooks"
# echo "Build kindle output"
# bundle exec jekyll build --config _config_kindle.yml,_config_simplifying-complexity.yml
# echo $?
# echo "Done building kindle output"
echo "Build kindle output"
bundle exec jekyll build --config _config_kindle.yml
echo $?
echo "Done building kindle output"
echo "Convert Kindle HTML into mobi file";
/Applications/Kindle\ Previewer\ 3.app/Contents/lib/fc/bin/kindlegen _site/docapis.opf;
echo $?
echo "Done creating mobi file"
echo "Move mobi file into mobi directory"
mv _site/docapis.mobi ebooks/docapis.mobi;
echo $?
echo "Done moving the file! Note that if the build failed, often due to missing media, there won't be a mobi file in the ebooks directory."
echo "Create epub output"
mv _site ebooks/docapis
cd ebooks/docapis
zip -rX docapis.epub mimetype META-INF/ .
echo $?
echo "Done creating epub"
echo "Move epub"
cd ../../
mv ebooks/$1/$1.epub ebooks/$1.epub
rm -r ebooks/$1/
echo $?
echo "Done moving epub"
echo "Ready to upload: run myvenv and then ./upload_outputs.sh"