forked from wakatime/textmate-wakatime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_dependencies.sh
47 lines (36 loc) · 1.06 KB
/
install_dependencies.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
#!/bin/bash
# install_dependencies.sh
#
# :description: post-build script to install wakatime python package
#
# :maintainer: WakaTime <[email protected]>
# :license: BSD, see LICENSE for more details.
# :website: https://wakatime.com/
set -e
set -x
if [ "$(uname -m)" = "arm64" ]; then
arch="arm64"
elif [ "$(uname -m)" = "x86_64" ]; then
arch="amd64"
fi
basename="wakatime-cli"
filename="${basename}-darwin-${arch}"
zip_file="${filename}.zip"
url="https://github.com/wakatime/wakatime-cli/releases/latest/download/${zip_file}"
extract_to="${HOME}/.wakatime"
old_package="${HOME}/Library/Application Support/TextMate/PlugIns/WakaTime.tmplugin/Contents/Resources/legacy-python-cli-master"
cd "$extract_to"
echo "Deleting old packages ..."
if [ -d "$old_package" ]; then
rm -rf "$old_package"
fi
if [ -f "$filename" ]; then
rm -rf "$filename"
fi
echo "Downloading wakatime-cli package to $extract_to ..."
curl -LO "$url"
echo "Unzipping wakatime-cli to $extract_to ..."
unzip -o "$zip_file"
ln -sf "$filename" "$basename"
rm "$zip_file"
echo "Finished."