Files
ProjectMD/setup-hooks.ps1

35 lines
1.4 KiB
PowerShell

# setup-hooks.ps1
Write-Host "🔧 Setting up Git hooks..." -ForegroundColor Cyan
Write-Host ""
# .git/hooks 디렉토리 존재 확인
if (-not (Test-Path ".git\hooks")) {
Write-Host "❌ .git\hooks 디렉토리를 찾을 수 없습니다." -ForegroundColor Red
Write-Host "💡 Git 저장소 루트에서 실행하세요." -ForegroundColor Yellow
exit 1
}
# hooks 복사
Write-Host "📋 Copying hook files..." -ForegroundColor Yellow
try {
Copy-Item -Path "git-hooks\pre-commit" -Destination ".git\hooks\pre-commit" -Force
Copy-Item -Path "git-hooks\post-commit" -Destination ".git\hooks\post-commit" -Force
Write-Host "✅ Git hooks installed!" -ForegroundColor Green
Write-Host ""
Write-Host "Installed hooks:" -ForegroundColor Cyan
Write-Host " - pre-commit: XLSX 데이터 검증" -ForegroundColor White
Write-Host " - post-commit: ScriptableObject 자동 생성" -ForegroundColor White
Write-Host ""
Write-Host "💡 사용법:" -ForegroundColor Cyan
Write-Host " 1. Excel에서 데이터 수정" -ForegroundColor White
Write-Host " 2. git add GameData/Towers.xlsx" -ForegroundColor White
Write-Host " 3. git commit -m 'Update data'" -ForegroundColor White
Write-Host " → 자동으로 검증 및 SO 생성" -ForegroundColor Gray
}
catch {
Write-Host "❌ Hook 파일 복사 실패: $_" -ForegroundColor Red
exit 1
}