-
Notifications
You must be signed in to change notification settings - Fork 0
/
web_dev_activate.zsh
163 lines (140 loc) · 5.78 KB
/
web_dev_activate.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
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#!/usr/bin/env zsh
############################################
# Scrip to build up folders and some files #
# Aim at Simple Web Development #
############################################
# TODO: Ask if 7.1 structure is wanted. If wanted pull it from
# GitHub: git@github.com:HugoGiraudel/sass-boilerplate.git
# Sass conversion
# Clone it, head into the project and then run:
# sass-convert -F scss -T sass -i -R ./ && find . -iname “*.scss” -exec bash -c 'mv "$0" “${0%\.scss}.sass"' {} \;
# Variables
INDEX=index.html
SCSS=scss/style.scss
CSS=css/style.css
DIR_SCSS=scss
DIR_CSS=css
# Colors
LIGHT_GREEN="\e[92m"
RESET="\e[97m"
YELLOW="\e[33m"
RED="\e[31m"
main() {
clear
# verify_directories
git_check
sass
}
function boilerplate() {
read -k $LIGHT_GREEN "Press 1 for Simple folder structure\nPress 2 for 7-1 boilerplate" $RESET
if [[ "$input" =~ ^[1]$ ]]; then
verify_directories
elif [[ "$input" =~ [2]$ ]]; then
seven_one_boilerplate
else
echo
boilerplate
fi
}
function check_for_boilerplate() {
# TODO check existance of boilerplate
function seven_one_boilerplate() {
# TODO build seven one boilerplate
}
function build_directories() {
touch index.html
mkdir scss css
touch scss/style.scss
touch css/style.css
touch README.md
echo ".gitignore\nnohup.out" > .gitignore
echo
}
function verify_directories() {
if [[ -d $DIR_SCSS || -d $DIR_CSS ]]; then
echo "css or scss directory already present!\n"
if [[ -z $(ls -A $DIR_SCSS) ]]; then
echo $YELLOW "$DIR_SCSS is empty! $RESET"
else
echo $RED "$DIR_SCSS is not empty! $RESET"
fi
if [[ -z $(ls -A $DIR_CSS) ]]; then
echo $YELLOW "$DIR_CSS is empty! $RESET"
else
echo $RED "$DIR_CSS is not empty! $RESET"
fi
# scss
if [[ -s $SCSS ]]; then
echo $RED "$SCSS is present and not empty! $RESET"
else
echo $YELLOW "$SCSS is present and is empty! $RESET"
fi
# css
if [[ -s $CSS ]]; then
echo $RED "$CSS is present and not empty! $RESET"
else
echo $YELLOW "$CSS is present and is empty! $RESET"
fi
fi
# index present? Empty?
if [[ -f $INDEX ]]; then
if [[ -s $INDEX ]]; then
echo $RED "$INDEX is present and not empty! $RESET"
else
echo $YELLOW "$INDEX is present and is empty! $RESET"
fi
else
# Get things done
build_directories
echo "Directories initialized in `pwd` :-) "
tree -aC -I '.git' --dirsfirst "$@" | less -FRNX
fi
}
function git_check() [
# TODO check if .git already exist
if [[ -d .git ]]; then
echo $YELLOW "This folder is already under version surveillance!"
else
git init
git add .
git commit -m "initial commit"
fi
]
# Sass Activate
function sass() {
read -k "input?Do you want to activate sass in the background [Y/n] "
if [[ "$input" =~ ^[Yy]$ ]]; then
nohup sass --watch scss:css &
echo $YELLOW
echo "Sass compiler adtivated with nohup, remember to run sassout when you are done."
banner
elif [[ "$input" =~ [Nn]$ ]]; then
banner
else
echo
sass
fi
}
# BANNER
function banner() {
echo $LIGHT_GREEN
cat << "EOF"
█╗░░░░░░░██╗███████╗██████╗░ ██████╗░███████╗██╗░░░██╗
░██║░░██╗░░██║██╔════╝██╔══██╗ ██╔══██╗██╔════╝██║░░░██║
░╚██╗████╗██╔╝█████╗░░██████╦╝ ██║░░██║█████╗░░╚██╗░██╔╝
░░████╔═████║░██╔══╝░░██╔══██╗ ██║░░██║██╔══╝░░░╚████╔╝░
░░╚██╔╝░╚██╔╝░███████╗██████╦╝ ██████╔╝███████╗░░╚██╔╝░░
░░░╚═╝░░░╚═╝░░╚══════╝╚═════╝░ ╚═════╝░╚══════╝░░░╚═╝░░░
░█████╗░░█████╗░████████╗██╗██╗░░░██╗░█████╗░████████╗███████╗██████╗░
██╔══██╗██╔══██╗╚══██╔══╝██║██║░░░██║██╔══██╗╚══██╔══╝██╔════╝██╔══██╗
███████║██║░░╚═╝░░░██║░░░██║╚██╗░██╔╝███████║░░░██║░░░█████╗░░██║░░██║
██╔══██║██║░░██╗░░░██║░░░██║░╚████╔╝░██╔══██║░░░██║░░░██╔══╝░░██║░░██║
██║░░██║╚█████╔╝░░░██║░░░██║░░╚██╔╝░░██║░░██║░░░██║░░░███████╗██████╔╝
╚═╝░░╚═╝░╚════╝░░░░╚═╝░░░╚═╝░░░╚═╝░░░╚═╝░░╚═╝░░░╚═╝░░░╚══════╝╚═════╝░
EOF
echo $RESET
}
function nanda() {
echo "this funct does nothoongh"
}
main "$@"