- create and enter the level's declared starting directory - inspect Git state from the repository containing the active directory - start the init level in /sandbox/git_hug and cover it with a runtime test - apply edited reword subjects as commit messages in the in-app rebase editor - cover rename_commit with a native interactive rebase regression test - remove the upstream contribute call to action from the playable level catalog - update level parity documentation
28 lines
1.1 KiB
Kotlin
28 lines
1.1 KiB
Kotlin
package solutions.tretter.githugandroid
|
|
|
|
/**
|
|
* Port of the upstream ruby-githug `init` level.
|
|
*
|
|
* Setup documents the repository shape the learner explores. Evaluation is kept
|
|
* state-based whenever the exercise changes repository objects; answer-only
|
|
* levels intentionally validate the answer entered at the prompt.
|
|
*/
|
|
internal fun initLevel(): Level = level(
|
|
id = "init",
|
|
title = "Init",
|
|
description = "A new directory, `git_hug`, has been created; initialize an empty repository in it.",
|
|
hints = listOf("You can type `git --help` or `git` in your shell to get a list of available git commands."),
|
|
commandSuggestions = listOf("git init", "git status"),
|
|
setup = { RepoState(currentDir = "git_hug") },
|
|
validator = repoPredicate { it.initialized },
|
|
testCases = listOf(
|
|
levelTestCase("plain init", "git init"),
|
|
),
|
|
setupChecks = listOf(
|
|
levelSetupCheck(
|
|
name = "starts in git_hug",
|
|
failureMessage = "Expected the learner to start in the created git_hug directory.",
|
|
) { repo -> repo.currentDir == "git_hug" && !repo.initialized },
|
|
),
|
|
)
|