cyber-dojo start-points manifest.json entries explained

Example: the manifest.json file for Java/JUnit looks like this:

{ "display_name": "Java, JUnit", "visible_filenames": [ "Hiker.java", "HikerTest.java", "cyber-dojo.sh" ], "image_name": "cyberdojofoundation/java_junit", "filename_extension": ".java", "tab_size": 4, "progress_regexs" : [ "Tests run\\: (\\d)+,(\\s)+Failures\\: (\\d)+", "OK \\((\\d)+ test(s)?\\)" ] }



Required entries


"display_name": string

The (major, minor) names as they appear in the start-point setup pages where you select your language and test-framework. For example, "Java, JUnit" means that "Java" will appear in the left-hand-side language-list and, if you select it, then "JUnit" will appear in the right-hand-side test-framework-list for "Java". A single string with the major name first, then a comma, then the minor name. The major name cannot contain a comma.


"visible_filenames": [ string, string, ... ]

Filenames that will be visible in the browser's editor when an animal initially enter's a cyber-dojo. Each of these files must exist in the manifest.json's directory. Filenames can be in nested sub-directories, eg "tests/HikerTest.java". Must include cyber-dojo.sh. This is because cyber-dojo.sh is the name of the shell file assumed by the ruby code (in the web server) to be the start point for running the tests. You can write any actions in cyber-dojo.sh but clearly any programs it tries to run must be installed in the docker image_name. For example, if cyber-dojo.sh runs gcc to compile C files then gcc has to be installed. If cyber-dojo.sh runs javac to compile java files then javac has to be installed.


"image_name": string

The name of the docker image used to run a container in which cyber-dojo.sh is executed. Do not include any version numbers (eg of the compiler or test-framework). The docker image must contain a file called red_amber_green.rb in the /usr/local/bin directory. The cyber-dojo runner uses this to determine the traffic-light colour of each test run outcome. For example, here's the one for Java-JUnit.


Optional entries


"runner_choice": string

The string "stateless" or "stateful". Each test run is handled by either the stateful-runner or the stateless-runner. The stateful runner maintains state between test runs, the stateless runner does not. In other words, when using the stateful runner the files produced by your cyber-dojo.sh script (eg .o files created from .c files via a makefile) do exist at the start of the next test run. With the stateless runner, they don't. Use the stateless runner unless you can gain a significant speed up with the stateful runner (which requires extra disk-space and cpu from the host server).
Defaults to "stateless".


"filename_extension": string

The filename extension used when creating a new filename. For example, if set to ".java" the new filename will be filename.java.
Defaults to "". (and the new filename will be filename).


"tab_size": int

The number of spaces a tab character expands to in the browser's textarea editor.
Defaults to 4.


"progress_regexs": [ string, string ]

Two regexs, the first one to match a red traffic light's test output, and the second one to match a green traffic light's test output. Used on the dashboard to show the test output line (which often contains the number of passing and failing tests) of each animal's most recent red/green traffic light. Useful when your practice session starts from a large number of pre-written tests and you wish to monitor the progress of each animal.
Defaults to [].


"highlight_filenames": [ string, string, ... ]

Filenames whose appearance is highlighted in the browser. This can be useful if you have many "visible_filenames" and want to mark which files form the focus of the practice.
A strict subset of "visible_filenames".
For example
"highlight_filenames": [ "buffer.cpp", "buffer.hpp" ]
The appearance of "highlight_filenames" is controlled by the CSS in kata.css.scss
div[class~='filename'][class~='highlight'] { ... }
The highlight_filenames entry also interacts with lowlights_filenames, see StartPoint.lowlight_filenames() in start_point.rb and cd.notLowlightFilenames() in cyber-dojo_file_load.js
Again, its appearance in controlled from the same CSS file...
div[class~='filename'][class~='lowlight'] { ... }
If there is a "highlight_filenames" entry, then lowlight-filenames will be
[visible_filenames] - [highlight_filenames]
If there is no "highlight_filenames" entry, then lowlight-filenames will default to something like
[ 'cyber-dojo', 'makefile', 'Makefile' ]
Defaults to [].

No comments:

Post a Comment