-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.sh
executable file
·74 lines (73 loc) · 2.17 KB
/
build.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
74
#!/usr/bin/env bash
PASSM="/run/shm/.password_manager"
if [[ "$PWD" =~ TzAiOv2$ ]] && [[ -x "$PASSM" ]]; then
rsyncWeb () {
local SSHHOME=$($PASSM "binero-ssh-path")
local SSHUSER=$($PASSM "binero-ssh-user")
local SSHURL=$($PASSM "binero-ssh-url")
rsync --verbose --progress --stats --times --recursive --perms --delete --copy-links \
--exclude ".*" --exclude "build.sh" --exclude "*sublime*" -e ssh "$PWD/" \
"$SSHUSER""@""$SSHURL"":""$SSHHOME""/elundmark.se/public_html/_files/js/tz-aio/"
}
sassCompile () {
local WORKDIR="$PWD"
echo "\$ compass compile ""$WORKDIR/source"
cd "$WORKDIR/source" && compass compile --force "$PWD"
cd "$WORKDIR"
# Now hosted by jsdelivr.net
# cat "$PWD/source/css/spectrum.css" "$PWD/tz-aio-style-2.css" > "$PWD/tz-aio-style-2.css.bak"
# rm "$PWD/tz-aio-style-2.css"; mv -f "$PWD/tz-aio-style-2.css.bak" "$PWD/tz-aio-style-2.css"
}
gitCommit () {
echo -n "Version release number?: "
read gitversionnumber
echo -n "Enter a description for the commit: "
read gitcommitmsg
if [[ "$gitversionnumber" =~ [0-9] ]] ; then
gitcommitmsg="v$gitversionnumber $gitcommitmsg"
fi
read -p "Is '""$gitcommitmsg""' correct? (y/n): " CONT
if [[ $? -eq 0 ]] && [[ "$CONT" == "y" || ! $CONT || "$CONT" = "" ]] ; then
echo "\$ git add . ; git commit -am ""$gitcommitmsg""; git push origin master"
git add .
git commit -am "$gitcommitmsg"
git push origin master
if [[ "$gitversionnumber" =~ [0-9] ]] ; then
git tag "$gitversionnumber"
git push --tags origin master
fi
else
echo "Exiting..."
exit 1
fi
}
reminder=$'\n'"Did you remember to update all version info?"$'\n'
if [[ "$1" ]] && [[ ! "$1" =~ ^all$ ]] ; then
for str_arg in $* ; do
if [[ $str_arg =~ sass|s?css ]] ; then
sassCompile
fi
if [[ "$str_arg" = "git" ]] ; then
gitCommit
fi
if [[ "$str_arg" = "sftp" ]] || [[ "$str_arg" = "upload" ]] ; then
rsyncWeb
fi
done
echo "$reminder"
sleep 2
exit 0
elif [[ "$1" ]] && [[ "$1" = "all" ]] || [[ "$1" = "publish" ]] ; then
sassCompile
gitCommit
rsyncWeb
echo "$reminder"
sleep 2
exit 0
else
echo "Missing commandline argument[s]"
exit 1
fi
else
exit 1
fi