|
1 | 1 | #!/bin/sh
|
2 | 2 |
|
3 |
| -for value in legacy stable |
4 |
| -do |
5 |
| - if [ ! -e "$value/Cargo.toml" ]; then |
6 |
| - if [ ! -d $value ]; then |
7 |
| - cargo new $value |
8 |
| - else |
9 |
| - cargo init $value |
10 |
| - fi |
11 |
| - if [ $value = legacy ]; then |
12 |
| - cat >> "$value/Cargo.toml" <<-EOF |
13 |
| - futures = "0.3" |
14 |
| - hyper = { version = "0.14", features = ["full"] } |
15 |
| - hyper-tls = "0.5" |
16 |
| - tokio = { version = "1", features = ["full"] } |
| 3 | +for value in legacy stable; do |
| 4 | + if [ ! -e "$value/Cargo.toml" ]; then |
| 5 | + if [ ! -d "$value" ]; then |
| 6 | + cargo new "$value" |
| 7 | + else |
| 8 | + cargo init "$value" |
| 9 | + fi |
| 10 | + |
| 11 | + case "$value" in |
| 12 | + legacy) |
| 13 | + cat >> "$value/Cargo.toml" <<-EOF |
| 14 | + [dependencies] |
| 15 | + futures = "0.3" |
| 16 | + hyper = { version = "0.14", features = ["full"] } |
| 17 | + hyper-tls = "0.5" |
| 18 | + tokio = { version = "1", features = ["full"] } |
17 | 19 | EOF
|
18 |
| - cargo build --manifest-path "$value/Cargo.toml" |
19 |
| - fi |
20 |
| - if [ $value = stable ]; then |
21 |
| - cat >> "$value/Cargo.toml" <<-EOF |
22 |
| - hyper = { version = "1", features = ["full"] } |
23 |
| - tokio = { version = "1", features = ["full"] } |
24 |
| - http-body-util = "0.1" |
25 |
| - hyper-util = { version = "0.1", features = ["full"] } |
26 |
| - tower = "0.4" |
| 20 | + ;; |
| 21 | + stable) |
| 22 | + cat >> "$value/Cargo.toml" <<-EOF |
| 23 | + [dependencies] |
| 24 | + hyper = { version = "1", features = ["full"] } |
| 25 | + tokio = { version = "1", features = ["full"] } |
| 26 | + http-body-util = "0.1" |
| 27 | + hyper-util = { version = "0.1", features = ["full"] } |
| 28 | + tower = "0.4" |
27 | 29 | EOF
|
28 |
| - cargo build --manifest-path "$value/Cargo.toml" |
29 |
| - fi |
30 |
| - fi |
| 30 | + ;; |
| 31 | + esac |
31 | 32 |
|
32 |
| - test_file() { |
33 |
| - echo "Testing: $f" |
34 |
| - rustdoc --edition 2021 --test $1 -L "$value/target/debug/deps" |
35 |
| - } |
| 33 | + cargo build --manifest-path "$value/Cargo.toml" |
| 34 | + fi |
36 | 35 |
|
37 |
| - if [ -n "$1" ]; then |
38 |
| - test_file $1 |
39 |
| - exit $? |
40 |
| - fi |
| 36 | + test_file() { |
| 37 | + echo "Testing: $1" |
| 38 | + rustdoc --edition 2021 --test "$1" -L "$value/target/debug/deps" |
| 39 | + } |
| 40 | + |
| 41 | + if [ -n "$1" ]; then |
| 42 | + test_file "$1" |
| 43 | + exit $? |
| 44 | + fi |
41 | 45 |
|
42 |
| - status=0 |
43 |
| - for f in `git ls-files | grep "^_$value\/.*\.md$"`; do |
44 |
| - test_file $f |
45 |
| - s=$? |
46 |
| - if [ "$s" != "0" ]; then |
47 |
| - status=$s |
48 |
| - fi |
49 |
| - done |
| 46 | + status=0 |
| 47 | + for f in $(git ls-files | grep "^_$value\/.*\.md$"); do |
| 48 | + test_file "$f" |
| 49 | + s=$? |
| 50 | + ((status == 0)) && status=$s |
| 51 | + done |
50 | 52 | done
|
51 | 53 |
|
52 | 54 | exit $status
|
0 commit comments