mirror of
https://github.com/rust-lang/rustlings.git
synced 2025-01-28 00:00:03 +03:00
skip clone and checkout if on gitpod workspace
This commit is contained in:
parent
bc3808cf29
commit
469218f7e3
46
install.sh
46
install.sh
|
@ -135,34 +135,40 @@ else
|
||||||
echo "SUCCESS: Rust is up to date"
|
echo "SUCCESS: Rust is up to date"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
Path=${1:-rustlings/}
|
# Check if GITPOD_WORKSPACE_ID environment variable exists
|
||||||
echo "Cloning Rustlings at $Path..."
|
if [ -z "$GITPOD_WORKSPACE_ID" ]; then
|
||||||
git clone -q https://github.com/rust-lang/rustlings "$Path"
|
Path=${1:-rustlings/}
|
||||||
|
|
||||||
cd "$Path"
|
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 | ${PY} -c "import json,sys;obj=json.load(sys.stdin);print(obj['tag_name']) if 'tag_name' in obj else sys.exit(f\"Error: {obj['message']}\");")
|
cd "$Path"
|
||||||
CargoBin="${CARGO_HOME:-$HOME/.cargo}/bin"
|
|
||||||
|
|
||||||
if [[ -z ${Version} ]]
|
Version=$(curl -s https://api.github.com/repos/rust-lang/rustlings/releases/latest | ${PY} -c "import json,sys;obj=json.load(sys.stdin);print(obj['tag_name']) if 'tag_name' in obj else sys.exit(f\"Error: {obj['message']}\");")
|
||||||
then
|
CargoBin="${CARGO_HOME:-$HOME/.cargo}/bin"
|
||||||
echo "The latest tag version could not be fetched remotely."
|
|
||||||
echo "Using the local git repository..."
|
if [[ -z ${Version} ]]
|
||||||
Version=$(ls -tr .git/refs/tags/ | tail -1)
|
|
||||||
if [[ -z ${Version} ]]
|
|
||||||
then
|
then
|
||||||
echo "No valid tag version found"
|
echo "The latest tag version could not be fetched remotely."
|
||||||
echo "Rustlings will be installed using the main branch"
|
echo "Using the local git repository..."
|
||||||
Version="main"
|
Version=$(ls -tr .git/refs/tags/ | tail -1)
|
||||||
|
if [[ -z ${Version} ]]
|
||||||
|
then
|
||||||
|
echo "No valid tag version found"
|
||||||
|
echo "Rustlings will be installed using the main branch"
|
||||||
|
Version="main"
|
||||||
|
else
|
||||||
|
Version="tags/${Version}"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
Version="tags/${Version}"
|
Version="tags/${Version}"
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
Version="tags/${Version}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Checking out version $Version..."
|
echo "Checking out version $Version..."
|
||||||
git checkout -q ${Version}
|
git checkout -q ${Version}
|
||||||
|
else
|
||||||
|
echo "GITPOD_WORKSPACE_ID found. Skipping git clone and git checkout."
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Installing the 'rustlings' executable..."
|
echo "Installing the 'rustlings' executable..."
|
||||||
cargo install --force --path .
|
cargo install --force --path .
|
||||||
|
|
1
rustlings
Submodule
1
rustlings
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 9a743f80c57cc6bf27819589a8ddb5a5579ab1a4
|
Loading…
Reference in a new issue