From b92c59860ed546d43b64cd3f77e6f97abb59c852 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sedat=20=C3=96zt=C3=BCrk?= Date: Tue, 11 Nov 2025 22:41:32 +0300 Subject: [PATCH] =?UTF-8?q?kurs-platform=20->=20erp-platform=20de=C4=9Fi?= =?UTF-8?q?=C5=9Fikli=C4=9Fi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- configs/rename-solutions.ps1 | 79 ++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 configs/rename-solutions.ps1 diff --git a/configs/rename-solutions.ps1 b/configs/rename-solutions.ps1 new file mode 100644 index 00000000..95481fa1 --- /dev/null +++ b/configs/rename-solutions.ps1 @@ -0,0 +1,79 @@ +# ===================================================== +# Tüm projede Kurs -> Erp dönüştürme scripti +# (Klasör, dosya, namespace, sln, csproj, json vs.) +# ===================================================== + +$basePath = "D:\Sozsoft\kurs-platform\api" +$oldPrefixes = @("Kurs.Platform", "Kurs.") +$newPrefixes = @("Erp.Platform", "Erp.") + +Write-Host "=====================================================" -ForegroundColor Cyan +Write-Host "KURS → ERP TAM DÖNÜŞÜM BAŞLATILDI" -ForegroundColor Cyan +Write-Host "Kök dizin: $basePath" +Write-Host "=====================================================" -ForegroundColor Cyan +Write-Host "" + +foreach ($i in 0..($oldPrefixes.Count - 1)) { + $old = $oldPrefixes[$i] + $new = $newPrefixes[$i] + + Write-Host "🔹 Değişim: $old → $new" -ForegroundColor Yellow + + # 1️⃣ Namespace, using ve genel metin dosyalarındaki içerik değişimi + Write-Host "➡ Metin tabanlı dosyalarda içerik güncelleniyor..." -ForegroundColor Yellow + $textExtensions = @("*.cs","*.csproj","*.sln","*.json","*.props","*.xml","*.config","*.dockerfile","*.md","*.ps1","*.yml","*.yaml") + Get-ChildItem -Path $basePath -Recurse -Include $textExtensions -ErrorAction SilentlyContinue | ForEach-Object { + try { + $content = Get-Content $_.FullName -Raw + $updated = $content.Replace($old, $new) + if ($content -ne $updated) { + $updated | Set-Content -Path $_.FullName -Force -Encoding UTF8 + Write-Host "✔ İçerik güncellendi: $($_.FullName)" -ForegroundColor Green + } + } + catch { + Write-Host "⚠ Dosya atlandı (kilitli): $($_.FullName)" -ForegroundColor Yellow + } + } + + # 2️⃣ Dosya adlarını güncelle + Write-Host "➡ Dosya adları güncelleniyor..." -ForegroundColor Yellow + Get-ChildItem -Path $basePath -Recurse -File -ErrorAction SilentlyContinue | Where-Object { $_.Name -like "$($old)*" } | ForEach-Object { + $newName = $_.Name.Replace($old, $new) + try { + Rename-Item -Path $_.FullName -NewName $newName -ErrorAction Stop + Write-Host "✔ Dosya adı değişti: $($_.Name) -> $newName" -ForegroundColor Cyan + } + catch { + Write-Host "⚠ Dosya atlandı: $($_.Name)" -ForegroundColor Yellow + } + } + + # 3️⃣ Klasör adlarını değiştir (gerçek rename) + Write-Host "➡ Klasör adları değiştiriliyor..." -ForegroundColor Yellow + Get-ChildItem -Path $basePath -Directory -Recurse -ErrorAction SilentlyContinue | Sort-Object FullName -Descending | ForEach-Object { + $folderName = Split-Path $_.FullName -Leaf + if ($folderName -like "$($old)*") { + $newName = $folderName.Replace($old, $new) + $parent = Split-Path $_.FullName -Parent + $targetPath = Join-Path $parent $newName + try { + if (-not (Test-Path $targetPath)) { + Move-Item -Path $_.FullName -Destination $targetPath -Force + Write-Host "✔ Klasör yeniden adlandırıldı: $folderName -> $newName" -ForegroundColor Magenta + } + else { + Write-Host "⚠ Atlandı (hedef zaten var): $targetPath" -ForegroundColor Yellow + } + } + catch { + Write-Host "⚠ Klasör atlandı: $folderName" -ForegroundColor Red + } + } + } +} + +Write-Host "" +Write-Host "=====================================================" -ForegroundColor Cyan +Write-Host "✅ TÜM DÖNÜŞÜM TAMAMLANDI — KURS → ERP" -ForegroundColor Green +Write-Host "=====================================================" -ForegroundColor Cyan