seed: curriculum content
This commit is contained in:
43
1.solar-system/1.welcome/12.the-initiator/index.md
Normal file
43
1.solar-system/1.welcome/12.the-initiator/index.md
Normal file
@@ -0,0 +1,43 @@
|
||||
---
|
||||
type: challenge
|
||||
title: "The Initiator"
|
||||
xp: 50
|
||||
duration: 20
|
||||
difficulty: 2
|
||||
---
|
||||
|
||||
# The Initiator
|
||||
|
||||
> **[INCOMING — Mission Control, Earth]**
|
||||
>
|
||||
> Cadet, ground zero. Take an empty directory and turn it into a
|
||||
> Git project.
|
||||
>
|
||||
> Two commands today:
|
||||
>
|
||||
> - `git init` — turns the current directory into a Git repository
|
||||
> (creates a hidden `.git/` folder)
|
||||
> - `git status` — shows what Git sees: branch, tracked, untracked
|
||||
>
|
||||
> Your script must:
|
||||
>
|
||||
> 1. Run `git init` (use `-b main` to set the default branch)
|
||||
> 2. Capture `git status` to `status-before.txt`
|
||||
> 3. Create `intro.md` containing `Hello, Git`
|
||||
> 4. Capture `git status` to `status-after.txt`
|
||||
>
|
||||
> Notice the second status sees the new file as *untracked* — that
|
||||
> distinction is the heart of how Git works.
|
||||
>
|
||||
> [END TRANSMISSION]
|
||||
|
||||
## Your Task
|
||||
|
||||
In `starter/starter.sh`, write the four steps above.
|
||||
|
||||
## Objectives
|
||||
|
||||
- `.git/` exists
|
||||
- `intro.md` contains `Hello, Git`
|
||||
- `status-before.txt` looks like git status output
|
||||
- `status-after.txt` mentions `intro.md`
|
||||
14
1.solar-system/1.welcome/12.the-initiator/starter/starter.sh
Normal file
14
1.solar-system/1.welcome/12.the-initiator/starter/starter.sh
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
# The Initiator — turn an empty directory into a Git repo.
|
||||
#
|
||||
# Your script must:
|
||||
# 1. Initialize a Git repo (use main as the default branch)
|
||||
# 2. Capture `git status` to status-before.txt
|
||||
# 3. Create intro.md containing exactly "Hello, Git"
|
||||
# 4. Capture `git status` to status-after.txt
|
||||
#
|
||||
# Notice how the second status sees intro.md as untracked.
|
||||
#
|
||||
# Tools: git init, git status, echo
|
||||
|
||||
# Your code here.
|
||||
13
1.solar-system/1.welcome/12.the-initiator/testing/test.sh
Normal file
13
1.solar-system/1.welcome/12.the-initiator/testing/test.sh
Normal file
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
bash solution.sh > /dev/null 2>&1
|
||||
|
||||
N=0
|
||||
report() { N=$((N+1)); if [ "$1" = "0" ]; then echo "ok $N - $2"; else echo "not ok $N - $2"; fi; }
|
||||
|
||||
[ -d .git ]; report $? ".git/ exists"
|
||||
[ -f intro.md ]; report $? "intro.md exists"
|
||||
grep -q "Hello, Git" intro.md 2>/dev/null; report $? "intro.md contains 'Hello, Git'"
|
||||
[ -f status-before.txt ]; report $? "status-before.txt exists"
|
||||
grep -qi "branch" status-before.txt 2>/dev/null; report $? "status-before.txt looks like git status output"
|
||||
[ -f status-after.txt ]; report $? "status-after.txt exists"
|
||||
grep -q "intro.md" status-after.txt 2>/dev/null; report $? "status-after.txt mentions intro.md"
|
||||
Reference in New Issue
Block a user