Skip to content

Commit 68f558b

Browse files
Implement exercise T1L3/undo-init (#179)
# Exercise Review ## Exercise Discussion #165 ## Checklist - [ ] If you require a new remote repository on the `Git-Mastery` organization, have you [created a request](https://github.com/git-mastery/exercises/issues/new?template=request_exercise_repository.md) for it? - [x] Have you written unit tests using [`repo-smith`](https://github.com/git-mastery/repo-smith) to validate the exercise grading scheme? - [x] Have you tested the download script using `test-download.sh`? - [x] Have you verified that this exercise does not already exist or is not currently in review? - [ ] Did you introduce a new grading mechanism that should belong to [`git-autograder`](https://github.com/git-mastery/git-autograder)? - [ ] Did you introduce a new dependency that should belong to [`app`](https://github.com/git-mastery/app)?
1 parent c77f03d commit 68f558b

File tree

12 files changed

+224
-0
lines changed

12 files changed

+224
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"exercise_name": "undo-init",
3+
"tags": [
4+
"git-init"
5+
],
6+
"requires_git": true,
7+
"requires_github": false,
8+
"base_files": {},
9+
"exercise_repo": {
10+
"repo_type": "local",
11+
"repo_name": "my-notes",
12+
"repo_title": null,
13+
"create_fork": null,
14+
"init": false
15+
}
16+
}

undo_init/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
See https://git-mastery.github.io/lessons/init/exercise-undo-init.html

undo_init/__init__.py

Whitespace-only changes.

undo_init/download.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import os
2+
from exercise_utils.file import create_or_update_file
3+
from exercise_utils.git import init
4+
5+
def setup(verbose: bool = False):
6+
create_or_update_file(
7+
"todo.txt",
8+
"""
9+
My tasks
10+
"""
11+
)
12+
13+
os.makedirs("private")
14+
os.chdir("private")
15+
create_or_update_file(
16+
"contacts.txt",
17+
"""
18+
My contacts
19+
"""
20+
)
21+
22+
os.chdir("..")
23+
init(verbose)

undo_init/tests/__init__.py

Whitespace-only changes.

undo_init/tests/specs/base.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
initialization:
2+
steps:
3+
- type: commit
4+
empty: true
5+
message: Set initial state
6+
id: start
7+
- type: new-file
8+
filename: todo.txt
9+
contents: |
10+
My tasks
11+
- type: new-file
12+
filename: private/contacts.txt
13+
contents: |
14+
My contacts
15+
- type: bash
16+
runs: rm -rf .git
17+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
initialization:
2+
steps:
3+
- type: commit
4+
empty: true
5+
message: Set initial state
6+
id: start
7+
- type: new-file
8+
filename: todo.txt
9+
contents: |
10+
My tasks
11+
- type: new-file
12+
filename: private/contacts.txt
13+
contents: |
14+
My contacts
15+
- type: delete-file
16+
filename: private/contacts.txt
17+
- type: bash
18+
runs: rm -rf .git
19+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
initialization:
2+
steps:
3+
- type: commit
4+
empty: true
5+
message: Set initial state
6+
id: start
7+
- type: new-file
8+
filename: todo.txt
9+
contents: |
10+
My tasks
11+
- type: new-file
12+
filename: private/contacts.txt
13+
contents: |
14+
My contacts
15+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
initialization:
2+
steps:
3+
- type: commit
4+
empty: true
5+
message: Set initial state
6+
id: start
7+
- type: new-file
8+
filename: todo.txt
9+
contents: |
10+
My tasks
11+
- type: bash
12+
runs: rm -rf .git
13+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
initialization:
2+
steps:
3+
- type: commit
4+
empty: true
5+
message: Set initial state
6+
id: start
7+
- type: new-file
8+
filename: private/contacts.txt
9+
contents: |
10+
My contacts
11+
- type: bash
12+
runs: rm -rf .git
13+

0 commit comments

Comments
 (0)