From 3d9b03c52b8dc51b140757f6fd25ad87b5782ef5 Mon Sep 17 00:00:00 2001 From: mokou Date: Thu, 27 Feb 2020 19:19:31 +0100 Subject: [PATCH] fix: Re-add cloning the repo to install scripts --- install.ps1 | 6 +++++- install.sh | 10 +++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/install.ps1 b/install.ps1 index 04ea4a0..6504e69 100644 --- a/install.ps1 +++ b/install.ps1 @@ -73,8 +73,12 @@ if (!($LASTEXITCODE -eq 0)) { $version = Invoke-WebRequest -UseBasicParsing https://api.github.com/repos/rust-lang/rustlings/releases/latest ` | ConvertFrom-Json | Select-Object -ExpandProperty tag_name +Write-Host "Checking out version $version..." +Set-Location $path +git checkout -q tags/$version + Write-Host "Installing the 'rustlings' executable..." -cargo install --force --git https://github.com/rust-lang/rustlings --tag $version +cargo install --force --path . if (!(Get-Command rustlings -ErrorAction SilentlyContinue)) { Write-Host "WARNING: Please check that you have '~/.cargo/bin' in your PATH environment variable!" } diff --git a/install.sh b/install.sh index 1075061..7abb406 100755 --- a/install.sh +++ b/install.sh @@ -82,11 +82,19 @@ 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']);") CargoBin="${CARGO_HOME:-$HOME/.cargo}/bin" +echo "Checking out version $Version..." +cd $Path +git checkout -q tags/$Version + echo "Installing the 'rustlings' executable..." -cargo install --force --git https://github.com/rust-lang/rustlings --tag $Version +cargo install --force --path . if ! [ -x "$(command -v rustlings)" ] then