-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
125 lines (91 loc) · 3.46 KB
/
Makefile
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# Makefile for the Data Science in Practice site
##########################################################################
## REQUIREMENTS
#
# This file requires `jupyter-book` for building the site.
#
##########################################################################
## VARIABLES
BOOK = dsip
CONTENT-ORG = https://github.com/COGS108
BOOK-ORG = https://github.com/datascienceinpractice
SITE-LOC = datascienceinpractice.github.io
##########################################################################
## CLONING MATERIALS
# Clone all materials
clone:
clone-tutorials
clone-assignments
clone-projects
# Clone the tutorials
clone-tutorials:
# Copy tutorial materials
@git clone --depth 1 $(CONTENT-ORG)/Tutorials $(BOOK)/tutorials
@rm $(BOOK)/tutorials/README.md
@rm -rf $(BOOK)/tutorials/.git
# Clone the assignments
clone-assignments:
# Clone assignments demo repo, and copy out files (to re-org & rename)
@git clone --depth 1 $(CONTENT-ORG)/Assign_Demo $(BOOK)/temp
@mv $(BOOK)/temp/release/A1/A1_git_python.ipynb $(BOOK)/assignments/D1_Python.ipynb
@mv $(BOOK)/temp/release/A2/A2_Pandas.ipynb $(BOOK)/assignments/D2_Pandas.ipynb
@mv $(BOOK)/temp/release/A3/A3_DataExploration.ipynb $(BOOK)/assignments/D3_DataExploration.ipynb
@mv $(BOOK)/temp/release/A4/A4_DataPrivacy.ipynb $(BOOK)/assignments/D4_DataPrivacy.ipynb
@mv $(BOOK)/temp/release/A5/A5_DataAnalysis.ipynb $(BOOK)/assignments/D5_DataAnalysis.ipynb
@mv $(BOOK)/temp/release/A6/A6_NaturalLanguageProcessing.ipynb $(BOOK)/assignments/D6_NaturalLanguageProcessing.ipynb
@rm -rf $(BOOK)/temp
# Clone the project information
clone-projects:
# Copy over the project repositories into temporary repositories
@git clone --depth 1 $(CONTENT-ORG)/Projects $(BOOK)/temp1
@git clone --depth 1 $(CONTENT-ORG)/group_template $(BOOK)/temp2
# Copy over the files we want
@mkdir $(BOOK)/projects
@mv $(BOOK)/temp1/README.md $(BOOK)/projects/project_checklist.md
@mv $(BOOK)/temp1/FinalProject_Guidelines.md $(BOOK)/projects/project_guidelines.md
@mv $(BOOK)/temp2/ProjectProposal_groupXXX.ipynb $(BOOK)/projects/ProjectProposal.ipynb
@mv $(BOOK)/temp2/FinalProject_groupXXX.ipynb $(BOOK)/projects/ProjectReport.ipynb
# Clear out the temporary folders
@rm -rf $(BOOK)/temp1
@rm -rf $(BOOK)/temp2
##########################################################################
## CLEAN UPS
# Clear out the copied repositories
clear:
# Clear all cloned materials
clear-tutorials
clear-assignemnts
clear-projects
clear-tutorials:
rm -rf $(BOOK)/tutorials
clear-assignemnts:
rm -rf $(BOOK)/assignments
clear-projects:
rm -rf $(BOOK)/projects
# Clean out the built textbook
clean:
jupyter-book clean $(BOOK_NAME)/
##########################################################################
## BUILDING SITE
# Build the textbook
build:
jupyter-book build $(BOOK)/
##########################################################################
## DEPLOYING SITE
# Deploy the website
deploy:
# Create the textbook
make build
# Clone the website host repository
rm -rf $(BOOK)/_build/deploy/
git clone --depth 1 $(BOOK-ORG)/$(SITE-LOC) $(BOOK)/_build/deploy/
# Add .nojekyll file to tell Github pages to bypass Jekyll processing
touch $(BOOK)/_build/deploy/.nojekyll
# Copy site source into the host repo folder, then push to Github to deploy
cd $(BOOK)/_build/ && \
cp -r html/ deploy && \
cd deploy && \
git add * && \
git add .nojekyll && \
git commit -a -m 'deploy site' && \
git push