gleam icon indicating copy to clipboard operation
gleam copied to clipboard

Update exercise generator tooling

Open BNAndras opened this issue 2 years ago • 5 comments

./bin/generate_practice_exercise pop-count
Fetching latest version of configlet...
Fetching configlet...
Downloaded configlet 4.0.0-beta.16 to ./bin/configlet
Adding instructions and configuration files...
sed: 1: "config.json.tmp": command c expects \ followed by text

The offending line is sed -i 's/"average_run_time": \([[:digit:]]\+\)$/"average_run_time": \1.0/' config.json.tmp. Per #306, average_run_time should be an integer in the first place so we don't need to work around jq.

BNAndras avatar Oct 26 '23 16:10 BNAndras

After I removed the sed line, I received a subsequent error while compiling gleam_stdlib on gleam 0.31.0.

Downloading packages
 Downloaded 4 packages in 0.06s
  Compiling thoas
===> Analyzing applications...
===> Compiling thoas
  Compiling gleam_stdlib
error: Syntax error
   ┌─ /Volumes/SSD/Git/Exercism/Mine/gleam/exercise_generator/build/packages/gleam_stdlib/src/gleam/bit_string.gleam:11:1
   │
11 │ if erlang {
   │ ^^ I was not expecting this.

Expected one of: 
An import, const, type, if block, or function.

I was able to remedy this by updating the dependencies inside the exercise_generator's gleam.toml file to their latest versions. Then the script ran through the end and generate the files I expected.

BNAndras avatar Oct 26 '23 20:10 BNAndras

The exercise generator generates Gleam files that don't pass the gleam format check in the CI. It'd be a good idea to have the generator kick out formatted code for the test suite and the stub file.

BNAndras avatar Oct 29 '23 01:10 BNAndras

I was the one who made the generator and added that line about the average run_time. The required format used to be the opposite of what it is now, it used to require a float, and it was so annoying :D

Also, calling the generator from bin/generate_practice_exercise does format the output.

It's more than probable that the dependencies need to be updated though.

jiegillet avatar Oct 29 '23 05:10 jiegillet

Thanks, I'll take another look since that script didn't seem to format the files when I ported pop-count.

BNAndras avatar Oct 29 '23 06:10 BNAndras

The required format used to be the opposite of what it is now, it used to require a float, and it was so annoying :D

It was, which is why I changed it :D

ErikSchierboom avatar Nov 01 '23 07:11 ErikSchierboom