exercism / pharo-smalltalk

Exercism exercises in Pharo.
https://exercism.org/tracks/pharo-smalltalk
MIT License
34 stars 28 forks source link

534 follow up on pr 400 #535

Closed Bajger closed 2 years ago

Bajger commented 2 years ago

@glennj : Feel free to review. It should contain your improvements on High Scores. I've had little struggle with generator, but achieved to get the solution and test files.

glennj commented 2 years ago

I don't grok how the generator works. Will these changes be safe from being overwritten?

Bajger commented 2 years ago

I don't grok how the generator works. Will these changes be safe from being overwritten?

ExercismGenerator is safe to use, since you execute generation on demand from Pharo and you can choose output directory where file artefacts are generated (it is under control and responsibility of developer - see ExercismGenerator>>generateSourceFilesFor: packageOrTag to: filePathString). I just used those two files that have been changed and overwritten manually solution and test class files. Rest of files remain unchanged (I didn't copied them). In other words: Reference implementation in dev/src/Exercise@ (content of Exercise packages in Pharo image) generates example solution file, test class file (and other metadata) to /exercise/practise/. Target directory is being checked by configlet lint rule checker (GH CI action). So I did semi-manually generated 2 of target files (lint rule checker was ok). I'm going to check if all generator artefacts (in separate issue) are ok for v3. This is how my code snippet looked like:

|gen aRef aPackage|
aPackage := RPackageOrganizer default packageNamed: 'Exercise@HighScores'.
aRef := FileLocator imageDirectory.
gen := ExercismGenerator new.
gen exercisesPath: aRef pathString .
gen exTonelWriter: (ExTonelWriter on: aRef).
gen generateSourceFilesFor: aPackage  to: aRef.

There is a way to generate all files from world menu, but it generates artefacts for all exercises at once. This isn't necessary, if you work on just one concrete exercise. So instead of this: image We could have this (for concrete Exercise): image

Bajger commented 2 years ago

Please ignore my previous message. Need to regenerate files...

Bajger commented 2 years ago

@glennj or @SleeplessByte : PR can be merged now. Thanks!

glennj commented 2 years ago

Thanks @Bajger !