-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from apiiro/yariv/fix_arch
Add support for different architectures
- Loading branch information
Showing
3 changed files
with
41 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
|
||
# USAGE: ./install.sh [version] | ||
# will install the latest tool executable to your /usr/local/bin | ||
|
||
set -e | ||
|
||
echo "Installing..." | ||
|
||
TMPDIR=${TMPDIR:-"/tmp"} | ||
pushd "$TMPDIR" > /dev/null | ||
mkdir -p complexity | ||
pushd complexity > /dev/null; | ||
distro=$(if [[ "$(uname -s)" == "Darwin" ]]; then echo "osx"; else echo "linux"; fi) | ||
arch=$(uname -m) | ||
if [ -n "$1" ] | ||
then | ||
echo "Will download and install v$1" | ||
curl -sSL --fail -o complexity.zip "https://github.com/apiiro/code-complexity/releases/download/v$1/complexity-$1-$distro-$arch.zip" | ||
else | ||
curl -s --fail https://api.github.com/repos/apiiro/code-complexity/releases/latest | grep "browser_download_url.*$distro-$arch.zip" | cut -d : -f 2,3 | tr -d \" | xargs curl -sSL --fail -o complexity.zip | ||
fi | ||
unzip complexity.zip | ||
chmod +x complexity-* | ||
cp -f complexity-* /usr/local/bin/complexity | ||
popd > /dev/null | ||
rm -rf complexity | ||
popd > /dev/null | ||
|
||
echo "Done: $(complexity -v)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters