File tree Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ echo " Let's get you set up with Rustlings!"
4
+
5
+ echo " Checking requirements..."
6
+ if [ -x " $( git) " ]
7
+ then
8
+ echo " WARNING: Git does not seem to be installed."
9
+ echo " Please download Git using your package manager or over https://git-scm.com/!"
10
+ exit 1
11
+ else
12
+ echo " SUCCESS: Git is installed"
13
+ fi
14
+
15
+ if [ -x " $( rustc) " ]
16
+ then
17
+ echo " WARNING: Rust does not seem to be installed."
18
+ echo " Please download Rust using https://rustup.rs!"
19
+ exit 1
20
+ else
21
+ echo " SUCCESS: Rust is installed"
22
+ fi
23
+
24
+ if [ -x " $( cargo) " ]
25
+ then
26
+ echo " WARNING: Cargo does not seem to be installed."
27
+ echo " Please download Rust and Cargo using https://rustup.rs!"
28
+ exit 1
29
+ else
30
+ echo " SUCCESS: Cargo is installed"
31
+ fi
32
+
33
+ Path=${1:- rustlings/ }
34
+ echo " Cloning Rustlings at $Path ..."
35
+ git clone -q https://github.com/rust-lang/rustlings $Path
36
+
37
+ 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']);" )
38
+ echo " Checking out version $Version ..."
39
+ cd $Path
40
+ git checkout -q tags/$Version
41
+
42
+ echo " Installing the 'rustlings' executable..."
43
+ cargo install --force --path .
44
+
45
+ if [ -x " $( rustlings) " ]
46
+ then
47
+ echo " WARNING: Please check that you have '~/.cargo/bin' in your PATH environment variable!"
48
+ fi
49
+
50
+ echo " All done! Run 'rustlings' to get started."
51
+
You can’t perform that action at this time.
0 commit comments