Add all 23 GoF design pattern implementations (2026-06-13)
This commit is contained in:
50
push-to-gitea.ps1
Normal file
50
push-to-gitea.ps1
Normal file
@@ -0,0 +1,50 @@
|
||||
$REMOTE = "https://ankurm.com/git.app/asmhatre/design-patterns.git"
|
||||
$BRANCH = "main"
|
||||
|
||||
Set-Location $PSScriptRoot
|
||||
|
||||
# Always run git init - it is safe and idempotent on an existing repo
|
||||
git init
|
||||
|
||||
# Configure remote
|
||||
$existing = git remote get-url origin 2>$null
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
git remote add origin $REMOTE
|
||||
Write-Host "Added remote." -ForegroundColor Green
|
||||
} elseif ($existing.Trim() -ne $REMOTE) {
|
||||
git remote set-url origin $REMOTE
|
||||
Write-Host "Updated remote." -ForegroundColor Yellow
|
||||
} else {
|
||||
Write-Host "Remote OK: $REMOTE" -ForegroundColor Cyan
|
||||
}
|
||||
|
||||
# Create .gitignore if missing
|
||||
if (-not (Test-Path ".gitignore")) {
|
||||
Set-Content ".gitignore" "out/`n*.class`nscreenshots/*.png`n*.b64.txt"
|
||||
Write-Host "Created .gitignore" -ForegroundColor Green
|
||||
}
|
||||
|
||||
# Stage and commit
|
||||
git add -A
|
||||
$status = git status --short
|
||||
|
||||
if (-not $status) {
|
||||
Write-Host "Nothing to commit - repo is up to date." -ForegroundColor Cyan
|
||||
exit 0
|
||||
}
|
||||
|
||||
Write-Host "`nFiles to commit:" -ForegroundColor Yellow
|
||||
Write-Host $status
|
||||
|
||||
$timestamp = Get-Date -Format "yyyy-MM-dd"
|
||||
git commit -m "Add all 23 GoF design pattern implementations ($timestamp)"
|
||||
|
||||
Write-Host "`nPushing to $REMOTE ..." -ForegroundColor Yellow
|
||||
git push -u origin $BRANCH
|
||||
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host "`nDone! Code live at $REMOTE" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "`nPush failed. Try manually: git push -u origin main" -ForegroundColor Red
|
||||
Write-Host "If prompted, enter your Gitea username and password." -ForegroundColor Yellow
|
||||
}
|
||||
Reference in New Issue
Block a user