Update oneshot installation to clone repository locally
- Modified install.ps1 to clone git-workshop repository to ~/git-workshop - Added option to remove existing directory before cloning - Updated documentation to reflect the new behavior - Now provides complete setup: install tools + clone repo in one command - Similar to Scoop's get.scoop.sh installation pattern
This commit is contained in:
42
install.ps1
42
install.ps1
@@ -197,6 +197,38 @@ catch {
|
||||
Write-Host " You can manually delete: $tempDir" -ForegroundColor Yellow
|
||||
}
|
||||
|
||||
# Clone the repository locally
|
||||
Write-Step "Cloning Git Workshop Repository"
|
||||
|
||||
$cloneDir = Join-Path $HOME "git-workshop"
|
||||
|
||||
try {
|
||||
if (Test-Path $cloneDir) {
|
||||
Write-Warning "Directory already exists: $cloneDir"
|
||||
$response = Read-Host " Do you want to remove it and clone fresh? (y/n)"
|
||||
if ($response.Trim().ToLower() -eq 'y' -or $response.Trim().ToLower() -eq 'yes') {
|
||||
Remove-Item -Path $cloneDir -Recurse -Force
|
||||
Write-Host " Removed existing directory" -ForegroundColor Gray
|
||||
}
|
||||
else {
|
||||
Write-Host " Skipping clone - using existing directory" -ForegroundColor Gray
|
||||
}
|
||||
}
|
||||
|
||||
if (-not (Test-Path $cloneDir)) {
|
||||
Write-Host " Cloning to: $cloneDir" -ForegroundColor Gray
|
||||
git clone "https://git.frod.dk/floppydiscen/git-workshop.git" $cloneDir
|
||||
Write-Success "Repository cloned successfully!"
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Write-Error "Failed to clone repository: $_"
|
||||
Write-Host ""
|
||||
Write-Host "You can clone manually:" -ForegroundColor Yellow
|
||||
Write-Host " git clone https://git.frod.dk/floppydiscen/git-workshop.git ~/git-workshop" -ForegroundColor White
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Final instructions
|
||||
Write-Step "Installation Complete"
|
||||
|
||||
@@ -204,11 +236,17 @@ Write-Host ""
|
||||
Write-Success "Git Workshop installation is complete!"
|
||||
Write-Host ""
|
||||
|
||||
Write-Host "Repository cloned to: $cloneDir" -ForegroundColor Green
|
||||
Write-Host ""
|
||||
|
||||
Write-Host "Next steps:" -ForegroundColor Cyan
|
||||
Write-Host " 1. Clone or download the Git Workshop repository" -ForegroundColor White
|
||||
Write-Host " 2. Configure Git if you haven't already:" -ForegroundColor White
|
||||
Write-Host " 1. Configure Git if you haven't already:" -ForegroundColor White
|
||||
Write-Host " git config --global user.name `"Your Name`"" -ForegroundColor Gray
|
||||
Write-Host " git config --global user.email `"your.email@example.com`"" -ForegroundColor Gray
|
||||
Write-Host ""
|
||||
Write-Host " 2. Navigate to the workshop:" -ForegroundColor White
|
||||
Write-Host " cd $cloneDir" -ForegroundColor Gray
|
||||
Write-Host ""
|
||||
Write-Host " 3. Start with the first module:" -ForegroundColor White
|
||||
Write-Host " cd 01-essentials\01-basics" -ForegroundColor Gray
|
||||
Write-Host " .\setup.ps1" -ForegroundColor Gray
|
||||
|
||||
Reference in New Issue
Block a user