From e72a1381d5e363768871f519c14da89ba27d9919 Mon Sep 17 00:00:00 2001 From: Jose Alberto Guerra Ugalde Date: Sat, 20 Dec 2025 01:43:07 -0600 Subject: [PATCH] Version 5.12.15.test PRUEBA --- B4A/_git_tag.ps1 | 74 +++++++++++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 35 deletions(-) diff --git a/B4A/_git_tag.ps1 b/B4A/_git_tag.ps1 index cbb9ec0..74d830d 100644 --- a/B4A/_git_tag.ps1 +++ b/B4A/_git_tag.ps1 @@ -1,14 +1,16 @@ -# --- SCRIPT DE AUTODESCUBRIMIENTO (VERSIÓN FORMATO SEGURO) --- +# --- SCRIPT DE AUTODESCUBRIMIENTO CON INTERFAZ VISUAL --- + +# Cargar librería para mensajes visuales +Add-Type -AssemblyName System.Windows.Forms # 1. AUTODESCUBRIMIENTO $projectPath = $PSScriptRoot -Write-Host "Ruta base: $projectPath" +Write-Host "Ruta: $projectPath" $b4aFileItem = Get-ChildItem -Path $projectPath -Filter "*.b4a" | Select-Object -First 1 if (-Not $b4aFileItem) { - Write-Error "ERROR: No hay archivo .b4a en esta carpeta." - Read-Host "Enter para salir" + [System.Windows.Forms.MessageBox]::Show("No hay archivo .b4a en esta carpeta.", "Error", "OK", "Error") return } @@ -16,6 +18,13 @@ $b4aFile = $b4aFileItem.FullName $projectName = $b4aFileItem.BaseName Write-Host "Proyecto: $projectName" +# 2. LIMPIEZA +# $objectsPath = Join-Path $projectPath "Objects" +# if (Test-Path $objectsPath) { + # Write-Host "Limpiando Objects..." + # Remove-Item -Path "$objectsPath\*" -Recurse -Force -ErrorAction SilentlyContinue +# } + # 3. LEER VERSIÓN $versionLine = Get-Content $b4aFile | Select-String "#VersionName:" if (-Not $versionLine) { Write-Error "Falta #VersionName"; return } @@ -24,66 +33,61 @@ $tagName = "v$version" Set-Location $projectPath -# 4. PREPARAR ARGUMENTOS (USANDO FORMATO SEGURO -f) -# Esto evita errores de sintaxis con comillas +# 4. COMMIT +$oldCommit = git rev-parse HEAD + +Write-Host "----------------------------------------" +Write-Host "Versión: $version" +Write-Host "Abriendo TortoiseGit..." + +# Argumentos limpios $pathArg = '/path:"{0}"' -f $projectPath $msgArg = '/logmsg:"Version {0}"' -f $version $cmdArg = "/command:commit" -# 5. EJECUTAR COMMIT -$oldCommit = git rev-parse HEAD - -Write-Host "----------------------------------------" -Write-Host "Version: $version" -Write-Host "Abriendo TortoiseGit..." - -# Pasamos la lista limpia de argumentos $process = Start-Process "TortoiseGitProc.exe" -ArgumentList $cmdArg, $pathArg, $msgArg -Wait -PassThru $newCommit = git rev-parse HEAD -# 6. VERIFICAR CAMBIOS +# 5. VALIDACIÓN if ($oldCommit -eq $newCommit) { - Write-Warning "Commit cancelado o sin cambios." - Start-Sleep -Seconds 2 + Write-Warning "Commit cancelado." return } Write-Host ">> Commit detectado." -# 7. GESTIÓN DE TAGS +# 6. GESTIÓN DE TAGS (VISUAL) $remoteTagInfo = git ls-remote --tags origin $tagName if ($remoteTagInfo) { - # Alerta Sonora y Visual + # --- AQUÍ ESTÁ LA MAGIA: VENTANA EMERGENTE --- [System.Console]::Beep(1000, 200) - [System.Console]::Beep(1000, 200) - [System.Console]::Beep(1000, 200) - Write-Host " " - Write-Host "AVISO: El tag '$tagName' YA EXISTE en GitHub." -ForegroundColor Red -BackgroundColor Yellow - $confirm = Read-Host ">> Escribe 's' y Enter para SOBRESCRIBIRLO" - if ($confirm -eq "s") { - # Borrar y recrear forzando + $msgBody = "El tag '$tagName' YA EXISTE en GitHub.`n`n¿Deseas SOBRESCRIBIRLO?`n`nSí = Borrar anterior y actualizar.`nNo = Subir solo código (mantener tag viejo)." + $msgTitle = "Conflicto de Versiones - $projectName" + + # Mostrar ventana Sí/No + $respuesta = [System.Windows.Forms.MessageBox]::Show($msgBody, $msgTitle, "YesNo", "Warning") + + if ($respuesta -eq "Yes") { + Write-Host "Sobrescribiendo..." git tag -d $tagName 2>$null git tag -a $tagName -m "Release version $version (Updated)" - Write-Host "Subiendo (Force)..." git push origin git push origin $tagName --force - Write-Host ">> Tag actualizado." -ForegroundColor Green + Write-Host ">> Tag actualizado (Force Push)." } else { + Write-Host "Conservando tag anterior..." git push origin - Write-Host ">> Codigo subido (Tag no actualizado)." + Write-Host ">> Código subido." } } else { - # Tag nuevo + # Tag Nuevo git tag -a $tagName -m "Release version $version" - Write-Host "Subiendo..." git push origin --follow-tags - Write-Host ">> Version publicada." -ForegroundColor Green + Write-Host ">> Versión publicada." } -Write-Host "----------------------------------------" -Write-Host "Cerrando en 5 segundos..." -Start-Sleep -Seconds 5 \ No newline at end of file +Write-Host "----------------------------------------" \ No newline at end of file