Files
2026-01-07 17:59:02 +01:00

65 lines
1.8 KiB
PowerShell

#!/usr/bin/env pwsh
<#
.SYNOPSIS
Sets up the Module 01 challenge environment.
.DESCRIPTION
Creates a challenge directory with files that need to be committed to git.
The student will need to initialize the repository and make commits.
#>
Write-Host "Setting up Module 01: Git Basics Challenge..." -ForegroundColor Cyan
Write-Host ""
# Remove existing challenge directory if it exists
if (Test-Path "challenge") {
Write-Host "Removing existing challenge directory..." -ForegroundColor Yellow
Remove-Item -Path "challenge" -Recurse -Force
}
# Create challenge directory
Write-Host "Creating challenge directory..." -ForegroundColor Green
New-Item -ItemType Directory -Path "challenge" | Out-Null
# Create welcome.txt
$welcomeContent = @"
Welcome to Git Workshop!
This is your first challenge. You'll learn the basics of git:
- Initializing a repository
- Staging changes
- Creating commits
Good luck!
"@
Set-Content -Path "challenge/welcome.txt" -Value $welcomeContent
# Create instructions.txt
$instructionsContent = @"
Git Basics Instructions
========================
The basic git workflow follows these steps:
1. Make changes to files in your working directory
2. Stage the changes you want to commit (git add)
3. Commit the staged changes with a message (git commit)
This workflow allows you to carefully select which changes
to include in each commit, making your history clean and meaningful.
"@
Set-Content -Path "challenge/instructions.txt" -Value $instructionsContent
Write-Host ""
Write-Host "Setup complete!" -ForegroundColor Green
Write-Host ""
Write-Host "Next steps:" -ForegroundColor Cyan
Write-Host " 1. cd challenge"
Write-Host " 2. Read the README.md in the parent directory"
Write-Host " 3. Complete the challenge"
Write-Host " 4. Run ../verify.ps1 to check your solution"
Write-Host ""