From 2ec2e9acb39bee3cc6da927b2cd91741c846b7c3 Mon Sep 17 00:00:00 2001 From: Jose Alberto Guerra Ugalde Date: Sat, 20 Dec 2025 01:34:37 -0600 Subject: [PATCH] Version 5.12.15.test PRUEBA --- B4A/_git_tag.ps1 | 66 +++++++++++++++++++++--------------------------- 1 file changed, 29 insertions(+), 37 deletions(-) diff --git a/B4A/_git_tag.ps1 b/B4A/_git_tag.ps1 index 0ff8864..322f0a9 100644 --- a/B4A/_git_tag.ps1 +++ b/B4A/_git_tag.ps1 @@ -1,10 +1,9 @@ -# --- SCRIPT DE AUTODESCUBRIMIENTO CON COMILLAS CORREGIDAS --- +# --- SCRIPT DE AUTODESCUBRIMIENTO (VERSIÓN FORMATO SEGURO) --- -# 1. ¿DÓNDE ESTOY? +# 1. AUTODESCUBRIMIENTO $projectPath = $PSScriptRoot -Write-Host "Buscando proyecto en: $projectPath" +Write-Host "Ruta base: $projectPath" -# 2. BUSCAR EL ARCHIVO .B4A $b4aFileItem = Get-ChildItem -Path $projectPath -Filter "*.b4a" | Select-Object -First 1 if (-Not $b4aFileItem) { @@ -17,47 +16,33 @@ $b4aFile = $b4aFileItem.FullName $projectName = $b4aFileItem.BaseName Write-Host "Proyecto: $projectName" -# --- 3. LIMPIEZA DE PROYECTO --- -#$objectsPath = Join-Path $projectPath "Objects" -#if (Test-Path $objectsPath) { -# Write-Host "Limpiando carpeta Objects..." -# Remove-Item -Path "$objectsPath\*" -Recurse -Force -ErrorAction SilentlyContinue -#} - -# --- 4. LEER VERSIÓN --- +# 3. LEER VERSIÓN $versionLine = Get-Content $b4aFile | Select-String "#VersionName:" -if (-Not $versionLine) { - Write-Error "Falta #VersionName" - return -} +if (-Not $versionLine) { Write-Error "Falta #VersionName"; return } $version = ($versionLine -split ":")[1].Trim() $tagName = "v$version" Set-Location $projectPath -# --- 5. EJECUTAR COMMIT --- +# 4. PREPARAR ARGUMENTOS (USANDO FORMATO SEGURO -f) +# Esto evita errores de sintaxis con comillas +$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 "Versión: $version" +Write-Host "Version: $version" Write-Host "Abriendo TortoiseGit..." -# --- CORRECCIÓN AQUÍ: AGREGAMOS COMILLAS EXPLICITAS --- -# Usamos `" para que Tortoise reciba la ruta entre comillas -$tortoiseArgs = @( - "/command:commit", - "/path:`"$projectPath`"", - "/logmsg:`"Version $version`"" -) - -# Debug para que veas cómo queda ahora -Write-Host "Comando: TortoiseGitProc.exe $tortoiseArgs" - -$process = Start-Process "TortoiseGitProc.exe" -ArgumentList $tortoiseArgs -Wait -PassThru +# Pasamos la lista limpia de argumentos +$process = Start-Process "TortoiseGitProc.exe" -ArgumentList $cmdArg, $pathArg, $msgArg -Wait -PassThru $newCommit = git rev-parse HEAD -# --- 6. LOGICA DE TAGS Y PUSH --- +# 6. VERIFICAR CAMBIOS if ($oldCommit -eq $newCommit) { Write-Warning "Commit cancelado o sin cambios." Start-Sleep -Seconds 2 @@ -66,30 +51,37 @@ if ($oldCommit -eq $newCommit) { Write-Host ">> Commit detectado." +# 7. GESTIÓN DE TAGS $remoteTagInfo = git ls-remote --tags origin $tagName if ($remoteTagInfo) { - Write-Warning "AVISO: El tag '$tagName' YA EXISTE en GitHub." - $confirm = Read-Host ">> ¿Deseas SOBRESCRIBIRLO? (s/n)" + # Alerta Sonora y Visual + [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 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." + Write-Host ">> Tag actualizado." -ForegroundColor Green } else { git push origin - Write-Host ">> Código subido (Tag no actualizado)." + Write-Host ">> Codigo subido (Tag no actualizado)." } } else { + # Tag nuevo git tag -a $tagName -m "Release version $version" Write-Host "Subiendo..." git push origin --follow-tags - Write-Host ">> Versión publicada." + Write-Host ">> Version publicada." -ForegroundColor Green } Write-Host "----------------------------------------" -Start-Sleep -Seconds 3 \ No newline at end of file +Write-Host "Cerrando en 5 segundos..." +Start-Sleep -Seconds 5 \ No newline at end of file