This commit is contained in:
40
cleanup.py
40
cleanup.py
@@ -1,40 +0,0 @@
|
||||
import re
|
||||
|
||||
# 1. Clean docker-compose.yml
|
||||
with open('docker-compose.yml', 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
|
||||
# Remove tool-email and tool-payment blocks
|
||||
content = re.sub(r'^\s*tool-(email|payment)-(blue|green):.*?^\s*- SPRING_PROFILES_ACTIVE=\$\{ACTIVE_PROFILE:-local\}\n\n?', '', content, flags=re.MULTILINE | re.DOTALL)
|
||||
# Remove MCP fallback routes
|
||||
content = re.sub(r'^\s*- MCP_GATEWAY_FALLBACK_ROUTES_(EMAIL|PAYMENT)=.*?\n', '', content, flags=re.MULTILINE)
|
||||
|
||||
with open('docker-compose.yml', 'w', encoding='utf-8') as f:
|
||||
f.write(content)
|
||||
|
||||
# 2. Clean deploy.yml
|
||||
with open('.gitea/workflows/deploy.yml', 'r', encoding='utf-8') as f:
|
||||
lines = f.readlines()
|
||||
|
||||
new_lines = []
|
||||
for line in lines:
|
||||
if 'tool-email' in line or 'tool-payment' in line:
|
||||
# For lines that have multiple tools (like docker compose stop), just remove the specific ones
|
||||
if 'docker compose stop' in line:
|
||||
line = re.sub(r' tool-(email|payment)-\$[A-Z_]+', '', line)
|
||||
new_lines.append(line)
|
||||
else:
|
||||
new_lines.append(line)
|
||||
|
||||
with open('.gitea/workflows/deploy.yml', 'w', encoding='utf-8') as f:
|
||||
f.writelines(new_lines)
|
||||
|
||||
# 3. Clean nginx/conf.d/default.conf
|
||||
with open('nginx/conf.d/default.conf', 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
|
||||
content = re.sub(r'upstream tool-(email|payment) \{.*?\n\}\n\n?', '', content, flags=re.MULTILINE | re.DOTALL)
|
||||
content = re.sub(r'server \{\n\s+listen 828[35];.*?\n\}\n\n?', '', content, flags=re.MULTILINE | re.DOTALL)
|
||||
|
||||
with open('nginx/conf.d/default.conf', 'w', encoding='utf-8') as f:
|
||||
f.write(content)
|
||||
@@ -1,34 +0,0 @@
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$extensions = @("*.java", "*.xml", "*.yml", "*.properties", "*.gradle", "*.md")
|
||||
$baseDir = "C:\eGovFrameDev-4.3.1-64bit\workspace-egov\axhub-backend-main"
|
||||
|
||||
Write-Host "Replacing text (Req -> Request, Res -> Response)..."
|
||||
Get-ChildItem -Path $baseDir -Include $extensions -Recurse -File | ForEach-Object {
|
||||
if ($_.FullName -notmatch "\\build\\" -and $_.FullName -notmatch "\\\.git\\" -and $_.FullName -notmatch "\\\.gradle\\" -and $_.FullName -notmatch "\\bin\\") {
|
||||
try {
|
||||
$content = Get-Content $_.FullName -Raw -Encoding UTF8
|
||||
$newContent = $content -creplace "Req\b", "Request"
|
||||
$newContent = $newContent -creplace "Res\b", "Response"
|
||||
if ($content -cne $newContent) {
|
||||
Write-Host "Updated text in: $($_.FullName)"
|
||||
$utf8NoBom = New-Object System.Text.UTF8Encoding $False
|
||||
[System.IO.File]::WriteAllText($_.FullName, $newContent, $utf8NoBom)
|
||||
}
|
||||
} catch {
|
||||
Write-Host "Skipped binary or locked file: $($_.FullName)"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "Renaming DTO files..."
|
||||
Get-ChildItem -Path $baseDir -Include *Req.java,*Res.java -Recurse -File | ForEach-Object {
|
||||
if ($_.FullName -notmatch "\\build\\" -and $_.FullName -notmatch "\\\.git\\" -and $_.FullName -notmatch "\\\.gradle\\" -and $_.FullName -notmatch "\\bin\\") {
|
||||
$newName = $_.Name -creplace "Req\.java$", "Request.java"
|
||||
$newName = $newName -creplace "Res\.java$", "Response.java"
|
||||
Write-Host "Renaming file: $($_.FullName) -> $newName"
|
||||
Rename-Item -Path $_.FullName -NewName $newName
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "DTO Refactoring completed!"
|
||||
33
refactor.ps1
33
refactor.ps1
@@ -1,33 +0,0 @@
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$extensions = @("*.java", "*.xml", "*.yml", "*.properties", "*.gradle", "*.md", "Dockerfile*")
|
||||
$baseDir = "C:\eGovFrameDev-4.3.1-64bit\workspace-egov\axhub-backend-main"
|
||||
|
||||
Write-Host "Replacing text..."
|
||||
Get-ChildItem -Path $baseDir -Include $extensions -Recurse -File | ForEach-Object {
|
||||
if ($_.FullName -notmatch "\\build\\" -and $_.FullName -notmatch "\\\.git\\" -and $_.FullName -notmatch "\\\.gradle\\" -and $_.FullName -notmatch "\\bin\\") {
|
||||
try {
|
||||
$content = Get-Content $_.FullName -Raw -Encoding UTF8
|
||||
$newContent = $content -replace "dapms", "mcg"
|
||||
$newContent = $newContent -replace "dapmt", "mcc"
|
||||
if ($content -cne $newContent) {
|
||||
Write-Host "Updated text in: $($_.FullName)"
|
||||
$utf8NoBom = New-Object System.Text.UTF8Encoding $False
|
||||
[System.IO.File]::WriteAllText($_.FullName, $newContent, $utf8NoBom)
|
||||
}
|
||||
} catch {
|
||||
Write-Host "Skipped binary or locked file: $($_.FullName)"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "Renaming directories..."
|
||||
Get-ChildItem -Path $baseDir -Recurse -Directory | Where-Object { $_.Name -eq "dapms" -or $_.Name -eq "dapmt" } | Sort-Object -Property @{Expression={$_.FullName.Length}; Descending=$true} | ForEach-Object {
|
||||
if ($_.FullName -notmatch "\\build\\" -and $_.FullName -notmatch "\\\.git\\" -and $_.FullName -notmatch "\\\.gradle\\" -and $_.FullName -notmatch "\\bin\\") {
|
||||
$newName = if ($_.Name -eq "dapms") { "mcg" } else { "mcc" }
|
||||
Write-Host "Renaming dir: $($_.FullName) -> $newName"
|
||||
Rename-Item -Path $_.FullName -NewName $newName
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "Refactoring completed!"
|
||||
Reference in New Issue
Block a user