Skip to content

Commit

Permalink
Better exercise var name in tests, rewritten generators to work with …
Browse files Browse the repository at this point in the history
…v3 (exercism#627)

* Exercise generator can regenerate existing exercises.

* fixed initializaiton of regenerating flag, fixed condition to produce UUID and version methods

* Update class documentation of exercism test generator.

* Update contributing guideline

* Make exercise generator more robust by testing required content of exercise dir.

* Refactored exercise source code generator to work just for given exercise (not all).

* Added checking and fetching of configlet, set repository path as default, updated corresponding tests

* improved test description for fetching configlet

* Use default root of configlet directory  from git repository. If not present, use parent of exercises dir.

* Fixed path in failing test.

* Updated configlet metadata update, tests update, change in referencing root directory of configlet

* Added update config  file method on ExercismConfigGenerator (work in progress, needs some test)

* Removed is followedBy is unlockedBy (with tests) - not used anymore in v3

* Removed concept of core and bonus exercises, removed autoApproved, deprecated attributes(from v2), added practise, concept exercises (v3).

* Removed unlockedBy attribute from exercise.

* Adjusted collection of v3 attributes that should be serialized to JSON config file for given exercise entry.

* Updated config.json generation according to v3, added unit tests for it.

* Fixed typo practise vs practice (new).

* Changed default path for all generators -> repository path is the default one.

* Refactored exercise configuration in config.json into own method.

* Fixed 'test_runner' key in config.json.

* Added key features, concepts to config.json. Moved attribute methods to Dev package.

* Sync UUID of exercises in Pharo source code with config.json to use UUID v4.

* Added config.json update for specific exercise.

* Added unit tests for config generator update of existing exercise.

* Refactored exporting of exercises (ExercismGenerator)  to use only necessary dir reference when initialized. Updated to  use practice exercises by default.

* Added fallback, when exercism repository path cannot be determined (when git project is not loaded in Pharo).

* Added fallback, when main config.json is missing when generating output just for specific exercise.

* Updated contributing guidelines.
  • Loading branch information
Bajger authored Feb 24, 2025
1 parent 4b5c50c commit d4fbc32
Show file tree
Hide file tree
Showing 66 changed files with 1,381 additions and 412 deletions.
1 change: 0 additions & 1 deletion dev/src/Exercise@Acronym/AcronymTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ Class {
{ #category : #config }
AcronymTest class >> exercise [
^(self createExerciseAfter: ReverseStringTest)
isCore: false;
difficulty: 2;
topics: #('strings' 'iteration' 'parsing');
yourself
Expand Down
3 changes: 1 addition & 2 deletions dev/src/Exercise@Allergies/AllergiesTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ AllergiesTest class >> exercise [
"Answer the configured exercise meta data for this exercise, an ExercismExercise"

^(self createExerciseAfter: GrainsTest)
isCore: true;
difficulty: 3;
topics: #('bitwise_operations' 'filtering');
yourself
Expand All @@ -69,7 +68,7 @@ AllergiesTest class >> generator [
{ #category : #config }
AllergiesTest class >> uuid [
"Answer a unique id for this exercise"
^'49ae8e78-a641-0d00-ba20-5f9f04641ab1'
^'a8c7d3df-5cd2-4342-a1d3-00821245add6'
]

{ #category : #config }
Expand Down
3 changes: 1 addition & 2 deletions dev/src/Exercise@Anagram/AnagramTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ AnagramTest class >> exercise [
"Answer the configured exercise meta data for this exercise, an ExercismExercise"

^(self createExerciseAfter: IsogramTest)
isCore: false;
difficulty: 3;
topics: #('strings' 'filtering');
yourself
Expand All @@ -37,7 +36,7 @@ AnagramTest class >> exercise [
{ #category : #config }
AnagramTest class >> uuid [
"Answer a unique id for this exercise"
^'cc8b42be-4a3f-0d00-bb2c-6d04071d6982'
^'a1edd1c3-bd5c-49cd-bebf-2ef9e1afb23d'
]

{ #category : #config }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ Class {
{ #category : #config }
ArmstrongNumbersTest class >> exercise [
^ (self createExerciseAfter: TwoFerTest)
isCore: false;
difficulty: 2;
topics: #('math' 'integers');
yourself
Expand All @@ -37,7 +36,7 @@ ArmstrongNumbersTest class >> exercise [
{ #category : #config }
ArmstrongNumbersTest class >> uuid [
"Answer a unique id for this exercise"
^'15f1a716-9d41-0d00-8fc9-66a908866539'
^'04c308a8-9794-4b15-9a73-775fca80ce9d'
]

{ #category : #config }
Expand Down
3 changes: 1 addition & 2 deletions dev/src/Exercise@AtbashCipher/AtbashCipherTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ AtbashCipherTest class >> exercise [
"Answer the configured exercise meta data for this exercise, an ExercismExercise"

^ (self createExerciseAfter: GrainsTest)
isCore: false;
difficulty: 3;
topics: #('algorithms' 'strings' 'transforming' 'cryptography');
yourself
Expand All @@ -57,7 +56,7 @@ AtbashCipherTest class >> exercise [
{ #category : #config }
AtbashCipherTest class >> uuid [
"Answer a unique id for this exercise"
^'c728b116-9d41-0d00-8fd2-aa8a08866539'
^'ac82cad2-5a80-4f0f-90d3-29e4cf12c916'
]

{ #category : #config }
Expand Down
3 changes: 1 addition & 2 deletions dev/src/Exercise@Binary/BinaryTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ BinaryTest class >> exercise [
"Answer the configured exercise meta data for this exercise, an ExercismExercise"

^(self createExerciseAfter: IsogramTest )
isCore: false;
difficulty: 3;
topics: #('strings' 'iteration' 'math');
yourself
Expand All @@ -70,7 +69,7 @@ BinaryTest class >> generator [
{ #category : #config }
BinaryTest class >> uuid [
"Answer a unique id for this exercise"
^'a90be8bb-8040-0d00-812e-0c1701deb008'
^'c54688bb-2237-49b1-986f-8e9fc3873ef1'
]

{ #category : #config }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ Class {
BinarySearchTreeTest class >> exercise [

^(ExercismExercise for: self)
isCore: false;
isAutoApproved: true;
difficulty: 6;
topics: #('algorithms' 'conditionals' 'data_structures' 'recursion');
yourself
Expand Down
3 changes: 1 addition & 2 deletions dev/src/Exercise@Bowling/BowlingTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ BowlingTest class >> exercise [
"Answer the configured exercise meta data for this exercise, an ExercismExercise"

^(self createExerciseAfter: GradeSchoolTest )
isCore: false;
difficulty: 5;
topics: #('conditionals' 'object_oriented_programming' 'algorithms');
yourself
Expand All @@ -98,7 +97,7 @@ BowlingTest class >> generator [
{ #category : #config }
BowlingTest class >> uuid [
"Answer a unique id for this exercise"
^'494d55f9-d941-0d00-a5c2-334307d29f14'
^'7af9188a-8e6c-4bb1-902e-cb335173f60e'
]

{ #category : #config }
Expand Down
2 changes: 0 additions & 2 deletions dev/src/Exercise@CircularBuffer/CircularBufferTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ Class {
CircularBufferTest class >> exercise [

^(ExercismExercise for: self)
isCore: false;
isAutoApproved: true;
difficulty: 5;
topics: #('arrays' 'conditionals' 'data_structures' 'exception_handling' 'lists' 'list-methods');
yourself
Expand Down
3 changes: 1 addition & 2 deletions dev/src/Exercise@Clock/ClockTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ ClockTest class >> exercise [
"Answer the configured exercise meta data for this exercise, an ExercismExercise"

^(self createExerciseAfter: LeapTest)
isCore: false;
difficulty: 2;
topics: #('math' 'classes' 'structural_equality');
yourself
Expand All @@ -46,7 +45,7 @@ ClockTest class >> generator [
{ #category : #config }
ClockTest class >> uuid [
"Answer a unique id for this exercise"
^'f8080717-9d41-0d00-9011-755a08866539'
^'1d22e220-b745-47de-b67d-441153800707'
]

{ #category : #config }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ CollatzConjectureTest class >> exercise [
"Answer the configured exercise meta data for this exercise, an ExercismExercise"

^ (self createExerciseAfter: GrainsTest)
isCore: false;
difficulty: 2;
topics:
#('recursion' 'control_flow' 'math');
Expand All @@ -63,7 +62,7 @@ CollatzConjectureTest class >> generator [
{ #category : #config }
CollatzConjectureTest class >> uuid [
"Answer a unique id for this exercise"
^'0dc70bf9-e642-0d00-8e2f-4d97059054ed'
^'eb02a87f-c2d9-4f5f-9089-f0942da0ac10'
]

{ #category : #config }
Expand Down
3 changes: 1 addition & 2 deletions dev/src/Exercise@Darts/DartsTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ DartsTest class >> exercise [
"Answer the configured exercise meta data for this exercise, an ExercismExercise"

^ (self createExerciseAfter: LeapTest)
isCore: false;
difficulty: 2;
topics: #('conditionals' 'math');
yourself
Expand All @@ -45,7 +44,7 @@ DartsTest class >> exercise [
{ #category : #config }
DartsTest class >> uuid [
"Answer a unique id for this exercise"
^'98fc253b-e642-0d00-8e1a-5ef3059054ed'
^'a0df4a77-8720-4e1a-ac52-8060f1425a2b'
]

{ #category : #config }
Expand Down
3 changes: 1 addition & 2 deletions dev/src/Exercise@Diamond/DiamondTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ DiamondTest class >> exercise [
"Answer the configured exercise meta data for this exercise, an ExercismExercise"

^(self createExerciseAfter: ReverseStringTest )
isCore: false;
difficulty: 3;
topics: #('strings' 'algorithms' 'lists' 'text_formatting');
yourself
Expand All @@ -82,7 +81,7 @@ DiamondTest class >> exercise [
{ #category : #config }
DiamondTest class >> uuid [
"Answer a unique id for this exercise"
^'c0b69b16-9d41-0d00-8fbf-acfc08866539'
^'7615f055-684e-4d04-99b3-25366dbd882a'
]

{ #category : #config }
Expand Down
3 changes: 1 addition & 2 deletions dev/src/Exercise@Die/DieTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ DieTest class >> exercise [
"Answer the configured exercise meta data for this exercise, an ExercismExercise"

^(ExercismExercise for: self)
isCore: false;
difficulty: 1;
topics: #('math');
yourself
Expand All @@ -43,7 +42,7 @@ DieTest class >> uuid [
"Answer a fixed String, the unique UUID for this exercise so the Exercism platform can identify it.
The id should be like: 'b5812b5e-2788-4ea6-b948-bfe54edeb0da' "

^'dbea4db3-5044-0d00-ab77-b35a0c226d01'
^'80102654-e4e5-47dc-88d9-34c95a901d4c'
]

{ #category : #config }
Expand Down
3 changes: 1 addition & 2 deletions dev/src/Exercise@Etl/EtlTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ EtlTest class >> exercise [
"Answer the configured exercise meta data for this exercise, an ExercismExercise"

^(self createExerciseAfter: ReverseStringTest)
isCore: false;
difficulty: 2;
topics: #('maps' 'iteration' 'transforming');
yourself
Expand All @@ -76,7 +75,7 @@ EtlTest class >> exercise [
{ #category : #config }
EtlTest class >> uuid [
"Answer a unique id for this exercise"
^'d6303b3f-0f41-0d00-a5e1-db510c056502'
^'5bf981a0-0647-4867-9026-b25021b48a23'
]

{ #category : #config }
Expand Down
3 changes: 1 addition & 2 deletions dev/src/Exercise@FlattenArray/FlattenArrayTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ FlattenArrayTest class >> exercise [
"Answer the configured exercise meta data for this exercise, an ExercismExercise"

^ (self createExerciseAfter: ReverseStringTest)
isCore: false;
difficulty: 2;
topics: #('lists' 'iteration' 'recursion' 'transforming');
yourself
Expand All @@ -38,7 +37,7 @@ FlattenArrayTest class >> exercise [
{ #category : #config }
FlattenArrayTest class >> uuid [
"Answer a unique id for this exercise"
^'aa15f716-9d41-0d00-9006-3c7208866539'
^'35411bfe-bd39-4d74-aaa3-a2e21d2c70a5'
]

{ #category : #config }
Expand Down
3 changes: 1 addition & 2 deletions dev/src/Exercise@Forth/ForthTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ ForthTest class >> exercise [
"Answer the configured exercise meta data for this exercise, an ExercismExercise"

^ (self createExerciseAfter: GradeSchoolTest)
isCore: true;
difficulty: 6;
topics: #('parsing' 'stacks');
yourself
Expand All @@ -54,7 +53,7 @@ ForthTest class >> exercise [
{ #category : #config }
ForthTest class >> uuid [
"Answer a unique id for this exercise"
^'98e35398-a743-0d00-aeac-1c4207045670'
^'1f200fc5-e4de-47c3-8d10-3d6180725e65'
]

{ #category : #config }
Expand Down
3 changes: 1 addition & 2 deletions dev/src/Exercise@GradeSchool/GradeSchoolTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ GradeSchoolTest class >> exercise [


^(self createExerciseAfter: MatrixTest)
isCore: true;
difficulty: 4;
topics: #('sorting' 'filtering' 'lists' 'object_oriented_programming');
yourself
Expand All @@ -75,7 +74,7 @@ GradeSchoolTest class >> generator [
{ #category : #config }
GradeSchoolTest class >> uuid [
"Answer a unique id for this exercise"
^'8198e8bb-8040-0d00-812f-dfab01deb008'
^'eb7d9c26-5188-4271-9d21-952903a5cf19'
]

{ #category : #config }
Expand Down
3 changes: 1 addition & 2 deletions dev/src/Exercise@Grains/GrainsTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ GrainsTest class >> exercise [
"Answer the configured exercise meta data for this exercise, an ExercismExercise"

^(self createExerciseAfter: IsogramTest)
isCore: true;
difficulty: 2;
topics: #('math' 'recursion');
yourself
Expand All @@ -58,7 +57,7 @@ GrainsTest class >> exercise [
{ #category : #config }
GrainsTest class >> uuid [
"Answer a unique id for this exercise"
^'93dde1bb-8040-0d00-812a-052301deb008'
^'9ea4cbd4-89ae-452c-aba4-e9c7b69be297'
]

{ #category : #config }
Expand Down
3 changes: 1 addition & 2 deletions dev/src/Exercise@Hamming/HammingTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ Class {
{ #category : #config }
HammingTest class >> exercise [
^(self createExerciseAfter: ReverseStringTest)
isCore: false;
difficulty: 2;
topics: #('equality' 'loops' 'strings' 'exception_handling');
yourself
Expand All @@ -50,7 +49,7 @@ HammingTest class >> exercise [
{ #category : #config }
HammingTest class >> uuid [
"Answer a unique id for this exercise"
^'69f615da-2b3f-0d00-a2ed-aca409f0590c'
^'8d936c18-7e4e-4d1d-8858-6508b7998f0d'
]

{ #category : #config }
Expand Down
2 changes: 0 additions & 2 deletions dev/src/Exercise@HelloWorld/HelloWorldTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ HelloWorldTest class >> exercise [
HelloWorld is a special case as it's the first exercise"

^(ExercismExercise for: self)
isCore: true;
isAutoApproved: true;
difficulty: 1;
topics: #('introduction' 'strings');
yourself
Expand Down
3 changes: 1 addition & 2 deletions dev/src/Exercise@HighScores/HighScoresTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ HighScoresTest class >> exercise [
"Answer the configured exercise meta data for this exercise, an ExercismExercise"

^(self createExerciseAfter: ReverseStringTest)
isCore: false;
difficulty: 2;
topics: #('lists' 'sorting' 'filtering');
yourself
Expand All @@ -36,7 +35,7 @@ HighScoresTest class >> exercise [
{ #category : #config }
HighScoresTest class >> uuid [
"Answer a unique id for this exercise"
^'5f1a9f16-9d41-0d00-8fc2-6a7408866539'
^'74992db6-e8f3-44c3-8798-02c6338a2bc5'
]

{ #category : #config }
Expand Down
3 changes: 1 addition & 2 deletions dev/src/Exercise@IsbnVerifier/IsbnVerifierTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ IsbnVerifierTest class >> exercise [
"Answer the configured exercise meta data for this exercise, an ExercismExercise"

^(self createExerciseAfter: LeapTest)
isCore: false;
difficulty: 3;
topics: #('characters' 'collections' 'validation');
yourself
Expand All @@ -70,7 +69,7 @@ IsbnVerifierTest class >> exercise [
{ #category : #config }
IsbnVerifierTest class >> uuid [
"Answer a unique id for this exercise"
^'d166a016-9d41-0d00-8fc3-1ee008866539'
^'9cb67bca-f8db-4bf6-b61e-d43318c821d7'
]

{ #category : #config }
Expand Down
3 changes: 1 addition & 2 deletions dev/src/Exercise@Isogram/IsogramTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ IsogramTest class >> exercise [
"Answer the configured exercise meta data for this exercise, an ExercismExercise"

^(self createExerciseAfter: ReverseStringTest)
isCore: true;
difficulty: 2;
topics: #('strings' 'iteration');
yourself
Expand All @@ -43,7 +42,7 @@ IsogramTest class >> exercise [
{ #category : #config }
IsogramTest class >> uuid [
"Answer a unique id for this exercise"
^'9e0074be-4a3f-0d00-bb4e-73e5071d6982'
^'fd5ea482-85e9-4b43-b40d-e04ce590c6e8'
]

{ #category : #config }
Expand Down
1 change: 0 additions & 1 deletion dev/src/Exercise@Leap/LeapTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ LeapTest class >> exercise [
"Answer the configured exercise meta data for this exercise, an ExercismExercise"

^(self createExerciseAfter: TwoFerTest)
isCore: true;
difficulty: 1;
topics: #('math' 'conditionals' 'logic');
yourself
Expand Down
3 changes: 1 addition & 2 deletions dev/src/Exercise@Luhn/LuhnTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ LuhnTest class >> exercise [
"Answer the configured exercise meta data for this exercise, an ExercismExercise"

^(self createExerciseAfter: GrainsTest)
isCore: false;
difficulty: 4;
topics: #('strings' 'math' 'algorithms');
yourself
Expand All @@ -94,7 +93,7 @@ LuhnTest class >> exercise [
{ #category : #config }
LuhnTest class >> uuid [
"Answer a unique id for this exercise"
^'6298e416-9d41-0d00-8ffa-c83508866539'
^'5470f2c4-f186-42df-8d0e-27aea57c1b80'
]

{ #category : #config }
Expand Down
Loading

0 comments on commit d4fbc32

Please sign in to comment.