summaryrefslogtreecommitdiff
path: root/install.sh
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-02-26 14:22:51 +0000
committerbors <bors@rust-lang.org>2020-02-26 14:22:51 +0000
commita03d9655a85351557c466f144a76d6bebfa27256 (patch)
treeaace341dbef4b15e37ddf260d6be857a11cca104 /install.sh
parent7e8530b21ff355c9b52e07eb3ba25278746a6932 (diff)
parent1e2fd9c92f8cd6e389525ca1a999fca4c90b5921 (diff)
Auto merge of #269 - Tarnadas:master, r=fmoko
feat: Add clippy lints This is a feature PR which adds the possiblity to create clippy exercises. Clippy has many awesome linting rules, which can give a deeper understanding about the Rust programming language, therefor I made this PR.
Diffstat (limited to 'install.sh')
-rwxr-xr-xinstall.sh21
1 files changed, 12 insertions, 9 deletions
diff --git a/install.sh b/install.sh
index 85bdad7..1075061 100755
--- a/install.sh
+++ b/install.sh
@@ -82,21 +82,24 @@ else
echo "SUCCESS: Rust is up to date"
fi
-Path=${1:-rustlings/}
-echo "Cloning Rustlings at $Path..."
-git clone -q https://github.com/rust-lang/rustlings $Path
-
Version=$(curl -s https://api.github.com/repos/rust-lang/rustlings/releases/latest | python -c "import json,sys;obj=json.load(sys.stdin);print(obj['tag_name']);")
-echo "Checking out version $Version..."
-cd $Path
-git checkout -q tags/$Version
+CargoBin="${CARGO_HOME:-$HOME/.cargo}/bin"
echo "Installing the 'rustlings' executable..."
-cargo install --force --path .
+cargo install --force --git https://github.com/rust-lang/rustlings --tag $Version
if ! [ -x "$(command -v rustlings)" ]
then
- echo "WARNING: Please check that you have '~/.cargo/bin' in your PATH environment variable!"
+ echo "WARNING: Please check that you have '$CargoBin' in your PATH environment variable!"
+fi
+
+# Checking whether Clippy is installed.
+# Due to a bug in Cargo, this must be done with Rustup: https://github.com/rust-lang/rustup/issues/1514
+Clippy=$(rustup component list | grep "clippy" | grep "installed")
+if [ -z "$Clippy" ]
+then
+ echo "Installing the 'cargo-clippy' executable..."
+ rustup component add clippy
fi
echo "All done! Run 'rustlings' to get started."