diff --git a/B4A/B4XMainPage.bas b/B4A/B4XMainPage.bas index d85aac0..c4ba2ce 100644 --- a/B4A/B4XMainPage.bas +++ b/B4A/B4XMainPage.bas @@ -12,6 +12,9 @@ Version=9.85 '###################### PULL ############################################################# 'Ctrl + click ide://run?file=%WINDIR%\System32\cmd.exe&Args=/c&Args=git&Args=pull '########################################################################################################### + '###################### PULL FORZADO ############################################################# + 'Ctrl + click Respaldar y Pull: ide://run?file=%WINDIR%\System32\cmd.exe&Args=/c&Args=start&Args=powershell.exe&Args=-ExecutionPolicy&Args=Bypass&Args=-File&Args=..\..\_sync_project.ps1 + '########################################################################################################### '###################### PUSH ############################################################# 'Ctrl + click ide://run?file=%WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe&Args=github&Args=..\..\ '########################################################################################################### diff --git a/B4A/INTMEX.b4a.meta b/B4A/INTMEX.b4a.meta index b85e85a..9f418f1 100644 --- a/B4A/INTMEX.b4a.meta +++ b/B4A/INTMEX.b4a.meta @@ -91,6 +91,6 @@ ModuleClosedNodes6= ModuleClosedNodes7= ModuleClosedNodes8= ModuleClosedNodes9= -NavigationStack=C_Cliente,Tar_Click,554,0,C_Cliente,Guardar_Click,619,6,C_Cliente,mandaPendientes,1277,0,Diseñador Visual,cliente.bal,-100,3,C_Cliente,Class_Globals,137,0,C_Cliente,B4XPage_Created,232,6,C_Cliente,B4XPage_Appear,238,0,C_Principal,Class_Globals,0,0,Diseñador Visual,principal.bal,-100,1,C_Principal,hacer_ped_Click,2596,0,C_Principal,Btn_Ubicar_Click,2636,0 +NavigationStack=C_Cliente,B4XPage_CloseRequest,543,0,C_Cliente,Tar_Click,554,0,C_Cliente,Guardar_Click,619,6,C_Cliente,mandaPendientes,1277,0,Diseñador Visual,cliente.bal,-100,3,C_Cliente,Class_Globals,137,0,C_Cliente,B4XPage_Appear,238,0,C_Cliente,B4XPage_Created,209,6,C_Principal,Class_Globals,0,0,B4XMainPage,Class_Globals,28,0,B4XMainPage,b_guardar_Click,789,0 SelectedBuild=0 VisibleModules=28,2,13,20,14,29,15,4,11,21 diff --git a/_sync_project.ps1 b/_sync_project.ps1 new file mode 100644 index 0000000..30fcb70 --- /dev/null +++ b/_sync_project.ps1 @@ -0,0 +1,61 @@ +# 1. Mensaje inicial y pausa +Clear-Host +Write-Host "Se va a hacer un respaldo del codigo actual en el directorio ""AutoBackups""" -ForegroundColor Yellow +Write-Host "y al terminar, traemos desde GitHub la ultima version del codigo." -ForegroundColor Yellow +Write-Host "" +Write-Host "Presione cualquier tecla para continuar..." -ForegroundColor Yellow +$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") + +# 2. Asegurar ubicación en la raíz +Set-Location $PSScriptRoot +Write-Host "`nScript ejecutado desde: $PWD" -ForegroundColor DarkGray + +# 3. Buscar el proyecto +$B4AFile = Get-ChildItem -Path ".\B4A\*.b4a" | Select-Object -First 1 +if (!$B4AFile) { + Write-Host "ERROR: No encontre el archivo .b4a" -ForegroundColor Red + Start-Sleep -Seconds 3 + exit +} + +$ProjectName = $B4AFile.BaseName +$BackupDir = ".\B4A\AutoBackups" +if (!(Test-Path $BackupDir)) { New-Item -ItemType Directory -Path $BackupDir } + +Write-Host "Respaldando $ProjectName..." -ForegroundColor Cyan + +# 4. Preparar archivos limpios (Método Copiar y Podar) +$tempFolder = Join-Path $env:TEMP "B4A_Stage_$ProjectName" +if (Test-Path $tempFolder) { Remove-Item $tempFolder -Recurse -Force -ErrorAction SilentlyContinue } +New-Item -ItemType Directory -Path $tempFolder | Out-Null + +Write-Host "Extrayendo archivos de codigo..." -ForegroundColor Gray +foreach ($f in @("B4A", "Files")) { + if (Test-Path $f) { + $target = Join-Path $tempFolder $f + Copy-Item -Path $f -Destination $target -Recurse -Force -ErrorAction SilentlyContinue + } +} + +Write-Host "Podando carpetas Objects y AutoBackups..." -ForegroundColor Gray +Remove-Item -Path "$tempFolder\B4A\Objects" -Recurse -Force -ErrorAction SilentlyContinue +Remove-Item -Path "$tempFolder\B4A\AutoBackups" -Recurse -Force -ErrorAction SilentlyContinue +Remove-Item -Path "$tempFolder\B4A\*.zip" -Force -ErrorAction SilentlyContinue + +# 5. Zipear +$Timestamp = Get-Date -Format "yyyyMMdd_HHmmss" +Write-Host "Comprimiendo..." -ForegroundColor Gray +Compress-Archive -Path "$tempFolder\*" -DestinationPath "$BackupDir\$ProjectName`_$Timestamp.zip" -Force +Remove-Item $tempFolder -Recurse -Force -ErrorAction SilentlyContinue + +Write-Host "¡Respaldo limpio creado con exito en AutoBackups!`n" -ForegroundColor Green + +# 6. Sincronizar con GitHub (Pull forzado) +Write-Host "--- Sincronizando con GitHub (Borrando cambios locales) ---" -ForegroundColor Cyan +git fetch --all +git reset --hard origin/main +git pull + +Write-Host "`n¡PROCESO COMPLETADO!" -ForegroundColor Green +# Pausa de 3 segundos para que veas el resultado antes de que se cierre sola +Start-Sleep -Seconds 3 \ No newline at end of file