1
1
LANG := en
2
- LANG_FILE := $(shell test -f LANGS.md.bak && echo LANGS.md.bak || echo LANGS.md)
2
+ LANG_FILE := $(shell test -f .langs && echo .langs || echo LANGS.md)
3
3
LANG_DATA := $(shell grep "$(LANG ) /" $(LANG_FILE ) )
4
4
LANG_NAME := $(shell echo "$(LANG_DATA ) " | sed 's/.* \[\(.* \) \].*/\1/')
5
- NODE := $(shell which nodse 1> /dev/null && echo "true")
6
5
7
6
define ebook_support
8
7
@if which ebook-convert 1> /dev/null; then\
9
8
npx honkit $(1 ) ./ ./djangogirls.$(1 ) ;\
10
9
else\
11
- echo "Error: ebook-convert is not found. Follow the guide at https://honkit.netlify.app/ebook";\
10
+ echo "Error: ebook-convert is not found";\
11
+ echo " * Follow the guide at https://honkit.netlify.app/ebook";\
12
+ echo " - For Debian/Ubuntu, Try: sudo apt install calibre";\
13
+ echo " - For MacOS, Try: brew install --cask calibre";\
14
+ echo " - For Windows and any other OS, Download from https://github.com/kovidgoyal/calibre/releases";\
15
+ false;\
12
16
fi
13
17
endef
14
18
@@ -35,15 +39,20 @@ help:
35
39
@echo
36
40
37
41
check : package.json book.json LANGS.md
38
- ifeq ($(NODE ) ,)
39
- $(error NodeJS not found. Please install/reinstall Node.js. NVM is recommended for installation(https://github.com/nvm-sh/nvm))
40
- endif
42
+ @if ! which node 1> /dev/null; then\
43
+ echo " Error: Node.js not found" ; \
44
+ echo " * Please install/reinstall NodeJS on your system." ; \
45
+ echo " * NVM is recommended for installation (https://github.com/nvm-sh/nvm)." ; \
46
+ false ; \
47
+ fi
41
48
42
49
setup : check
43
- @if ! test -f " LANGS.md.bak" ; then\
44
- cp LANGS.md LANGS.md.bak && echo " Language file backup is created." ; \
45
- echo " $( LANG_DATA) " > LANGS.md && echo " Language list is reduced to $( LANG_NAME) for development" ; \
46
- npm install && echo " Project is ready for development." ; \
50
+ @if ! test -f " .langs" ; then\
51
+ cp LANGS.md .langs && \
52
+ echo " $( LANG_DATA) " > LANGS.md && \
53
+ echo " You are set to $( LANG_NAME) for development" ; \
54
+ npm install && \
55
+ echo " Project is ready for development." ; \
47
56
fi
48
57
49
58
build : setup
@@ -59,15 +68,15 @@ dev: setup
59
68
@npx honkit serve --log=debug
60
69
61
70
mode :
62
- @if test -f " LANGS.md.bak " ; then\
71
+ @if test -f " .langs " ; then\
63
72
echo " You are in development mode" ; \
64
73
else\
65
74
echo " You are not in development mode" ; \
66
75
fi
67
76
68
77
exit :
69
- @if test -f " LANGS.md.bak " ; then\
70
- mv -f LANGS.md.bak LANGS.md && echo " Language file is reset" ; \
78
+ @if test -f " .langs " ; then\
79
+ mv -f .langs LANGS.md && echo " Language file is reset" ; \
71
80
rm -rf node_modules _book && echo " The project exited development mode." ; \
72
81
fi
73
82
0 commit comments