forked from janosgyerik/sonarlint-git-hooks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
get-and-setup-sonarlint.sh
executable file
·50 lines (39 loc) · 1.17 KB
/
get-and-setup-sonarlint.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
#!/usr/bin/env bash
info() {
echo info: "$@"
}
fatal() {
echo fatal: "$@"
exit 1
}
set -e
cd "$(dirname "$0")"
info "downloading sonarlint into $PWD/work ..."
mkdir -p work
cd work
release=2.1.0.566
dirname=sonarlint-cli-$release
archive=$dirname.zip
wget -c -O $archive https://bintray.com/sonarsource/Distribution/download_file?file_path=sonarlint-cli%2Fsonarlint-cli-$release.zip
rm -fr $dirname
unzip $archive || {
rm -f $archive
fatal 'failed to unzip the file, try to download again'
}
cd $dirname
info "creating symbolic link to sonarlint from ~/bin/sonarlint ..."
mkdir -p ~/bin
ln -sf "$PWD"/bin/sonarlint ~/bin/
info "checking sonarlint executability"
if ! type sonarlint &>/dev/null; then
cat << "EOF" >&2
*******************************************************************************
fatal: it seems ~/bin is not on PATH
You can add it temporarily for the current shell by running this command:
PATH=$HOME/bin:$PATH
To make that permanent, add this line to your ~/.bashrc or ~/.bash_profile
or ~/.profile, as appropriate for your environment.
*******************************************************************************
EOF
exit 1
fi