-
Notifications
You must be signed in to change notification settings - Fork 0
/
customize
41 lines (33 loc) · 1.13 KB
/
customize
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
#!/usr/bin/env bash
# https://formulae.brew.sh/formula/tree
command -v tree >/dev/null 2>&1 || { echo >&2 "I require tree but it's not installed. Aborting."; exit 1; }
# https://formulae.brew.sh/formula/gomplate
command -v gomplate >/dev/null 2>&1 || { echo >&2 "I require gomplate but it's not installed. Aborting."; exit 1; }
ignore_files=".git|_templates|customize|template_README.md"
for input_file in `tree -I "${ignore_files}" -Ffai --noreport`
do
if [ ! -d "${input_file}" ]; then
echo "Processing file: ${input_file}"
gomplate \
-f "${input_file}" \
-o "${input_file}" \
--left-delim "<<[" \
--right-delim "]>>" \
-c cus=./customize.json
fi
done
if [ -f "./configs.json" ]; then
# Merge configs and only add new properties to the existing config file.
contents="$(jq -s '.[0] * .[1]' initial_configs.json configs.json)" && echo "${contents}" > configs.json
else
mv initial_configs.json configs.json
fi
# Remove previous GitHub source
rm -rf .github
# Move GH folder
mv github .github
# Clean up / implode
rm template_README.md
rm customize
rm customize.json
rm initial_configs.json