File tree Expand file tree Collapse file tree 5 files changed +1
-21
lines changed Expand file tree Collapse file tree 5 files changed +1
-21
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ command -v curl >/dev/null 2>&1 || {
37
37
exit 1
38
38
}
39
39
40
+ # Check if configlet is already fetched
40
41
if [ -e bin/configlet ]; then
41
42
message " success" " Configlet found!"
42
43
else
@@ -57,7 +58,6 @@ canonical_json=$(bin/fetch_canonical_data "$slug")
57
58
has_canonical_data=true
58
59
if [ " ${canonical_json} " == " 404: Not Found" ]; then
59
60
has_canonical_data=false
60
-
61
61
message " warning" " This exercise doesn't have canonical data"
62
62
63
63
else
@@ -81,7 +81,6 @@ create_rust_files "$exercise_dir" "$slug" "$has_canonical_data"
81
81
# ==================================================
82
82
83
83
# Build configlet
84
-
85
84
./bin/fetch-configlet
86
85
message " success" " Fetched configlet successfully!"
87
86
Original file line number Diff line number Diff line change @@ -10,5 +10,4 @@ cyan=$(echo -e '\033[0;36m')
10
10
11
11
bold_green=$( echo -e ' \033[1;32m' )
12
12
13
-
14
13
export red green blue yellow bold_green reset_color cyan
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
3
-
4
3
# see comment in utils.sh
5
4
# shellcheck source=bin/generator-utils/colors.sh
6
5
# shellcheck source=./colors.sh
7
6
source ./bin/generator-utils/colors.sh
8
7
9
8
get_exercise_difficulty () {
10
-
11
9
read -rp " Difficulty of exercise (1-10): " exercise_difficulty
12
10
echo " $exercise_difficulty "
13
11
}
14
12
15
-
16
13
validate_difficulty_input () {
17
-
18
14
local valid_input=false
19
15
while ! $valid_input ; do
20
16
if [[ " $1 " =~ ^[1-9]$| ^10$ ]]; then
@@ -30,7 +26,6 @@ validate_difficulty_input() {
30
26
echo " $exercise_difficulty "
31
27
}
32
28
33
-
34
29
get_author_handle () {
35
30
local default_author_handle
36
31
default_author_handle=" $( git config user.name) "
Original file line number Diff line number Diff line change @@ -22,7 +22,6 @@ create_fn_name() {
22
22
}
23
23
24
24
create_test_file_template () {
25
-
26
25
local exercise_dir=$1
27
26
local slug=$2
28
27
local has_canonical_data=$3
@@ -116,14 +115,12 @@ EOT
116
115
message " success" " .gitignore has been overwritten!"
117
116
}
118
117
119
-
120
118
create_example_rs_template () {
121
119
122
120
local exercise_dir=$1
123
121
local slug=$2
124
122
local has_canonical_data=$3
125
123
126
-
127
124
local fn_name
128
125
129
126
fn_name=$( create_fn_name " $slug " " $has_canonical_data " )
139
136
message " success" " Stub file for example.rs has been created!"
140
137
}
141
138
142
-
143
139
create_rust_files () {
144
140
145
141
local exercise_dir=$1
Original file line number Diff line number Diff line change 9
9
source ./bin/generator-utils/colors.sh
10
10
11
11
message () {
12
-
13
12
local flag=$1
14
13
local message=$2
15
14
16
15
case " $flag " in
17
-
18
16
" success" ) printf " ${green} %s${reset_color} \n" " [success]: $message " ;;
19
17
" task" ) printf " ${cyan} %s${reset_color} \n" " [task]: $message " ;;
20
18
" info" ) printf " ${blue} %s${reset_color} \n" " [info]: $message " ;;
@@ -36,9 +34,7 @@ message() {
36
34
esac
37
35
}
38
36
39
-
40
37
dash_to_underscore () {
41
-
42
38
echo " $1 " | sed ' s/-/_/g'
43
39
}
44
40
@@ -58,10 +54,8 @@ check_exercise_existence() {
58
54
exit 1
59
55
fi
60
56
61
-
62
57
# Fetch configlet and crop out exercise list
63
58
local unimplemented_exercises
64
-
65
59
unimplemented_exercises=$( bin/configlet info | sed -n ' /With canonical data:/,/Track summary:/p' | sed -e ' /\(With\(out\)\? canonical data:\|Track summary:\)/d' -e ' /^$/d' )
66
60
if echo " $unimplemented_exercises " | grep -q " ^$slug $" ; then
67
61
message " success" " Exercise has been found!"
@@ -78,11 +72,8 @@ ${unimplemented_exercises}"
78
72
echo " ${yellow} $( bin/generator-utils/ngram " ${unimplemented_exercises} " " $slug " ) ${reset_color} "
79
73
else
80
74
message " info" " Building typo-checker binary for $( uname -m) system."
81
-
82
75
cd util/ngram && ./build && cd ../.. && echo " ${yellow} $( bin/generator-utils/ngram " ${unimplemented_exercises} " " $slug " ) ${reset_color} "
83
-
84
76
fi
85
-
86
77
exit 1
87
78
fi
88
79
}
You can’t perform that action at this time.
0 commit comments