-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild_100_days.zsh
executable file
·62 lines (46 loc) · 1.2 KB
/
build_100_days.zsh
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
#!/bin/zsh
## Get day number
tail README.md
echo "What number day is it?"
read dayNumber
re='^[0-9]+$'
if ! [[ $dayNumber =~ $re ]];
then
echo "error: You did not enter an integer."
exit 1
fi
source activate daysOfCode-env
# Build notebooks for various pedagogical sources.
# zsh ipynb_to_md.zsh "pfda"
# zsh ipynb_to_md.zsh "cs20"
zsh ipynb_to_md.zsh "homl"
zsh ipynb_to_md.zsh "plotting"
## Write virtual environment to requirements.txt
conda list -e > requirements.txt
conda deactivate
## Add to README
currentDate=$(date +"%B %d, %Y")
MESSAGE_FILE_NAME=".tmp_dialy_message_file.txt"
rm $MESSAGE_FILE_NAME
vim $MESSAGE_FILE_NAME
readmeMessage="**Day $dayNumber - $currentDate:**\n$(cat $MESSAGE_FILE_NAME | sed 's/\. */.\/g')"
echo $readmeMessage
echo $readmeMessage >> README.md
## Git Commit
commitMessage="$dayNumber of 100 Days of Python\n$(cat $MESSAGE_FILE_NAME | fold -w 80 -s)"
rm $MESSAGE_FILE_NAME
echo "\n---\nHere is todays commit message:"
echo $commitMessage
echo "\n"
echo "Shall I commit to git? (y/n)"
read shouldCommit
if [[ $shouldCommit == 'y' ]]
then
echo "Comitting to git repo..."
git add --all
git commit -m $commitMessage
git push
else
echo "Nothing commited."
fi
exit