forked from labbots/google-drive-upload
-
Notifications
You must be signed in to change notification settings - Fork 2
/
release.sh
73 lines (61 loc) · 1.89 KB
/
release.sh
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
#!/usr/bin/env sh
set -e
sh format_and_lint.sh
printf "Merging Scripts and minifying...\n"
_PARENT_DIR="${PWD}"
cd src || exit 1
_merge() (
shell="${1:?Error: give folder name.}"
{ [ "${shell}" = "sh" ] && flag="-p"; } || flag=""
mkdir -p "${_PARENT_DIR}/release/${shell}"
release_path="${_PARENT_DIR}/release/${shell}"
# gupload
{
sed -n 1p "upload.${shell}"
printf "%s\n" 'SELF_SOURCE="true"'
# shellcheck disable=SC2086
{
# this is to export the functions so that can used in parallel functions
echo 'set -a'
sed 1d "${shell}/common-utils.${shell}"
for script in \
update.sh \
parser.sh \
upload-flags.sh \
auth-utils.sh \
common-utils.sh \
drive-utils.sh \
upload-utils.sh \
upload-common.sh; do
sed 1d "common/${script}"
done
echo 'set +a'
sed 1d "upload.${shell}"
} | shfmt -mn ${flag}
} >| "${release_path}/gupload"
chmod +x "${release_path}/gupload"
printf "%s\n" "${release_path}/gupload done."
# gsync
{
sed -n 1p "sync.${shell}"
printf "%s\n" 'SELF_SOURCE="true"'
# shellcheck disable=SC2086
{
# this is to export the functions so that can used in parallel functions
echo 'set -a'
sed 1d "${shell}/common-utils.${shell}"
for script in \
parser.sh \
sync-flags.sh \
common-utils.sh; do
sed 1d "common/${script}"
done
echo 'set +a'
sed 1d "sync.${shell}"
} | shfmt -mn ${flag}
} >| "${release_path}/gsync"
chmod +x "${release_path}/gsync"
printf "%s\n" "${release_path}/gsync done."
)
_merge sh
_merge bash