pack.cmd 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. @echo off
  2. setlocal enabledelayedexpansion
  3. echo QDR Temporary Shared Storage Plugin Packager
  4. echo ===========================================
  5. echo.
  6. :: Set variables
  7. set PLUGIN_NAME=qdr-temporary-shared-storage
  8. set DEPLOY_DIR=D:\Deploy
  9. set CURRENT_DIR=%CD%
  10. set TARGET_ZIP=%DEPLOY_DIR%\%PLUGIN_NAME%.zip
  11. set SCRIPT_NAME=%~nx0
  12. :: Create deploy directory if it doesn't exist
  13. if not exist "%DEPLOY_DIR%" (
  14. echo Creating deploy directory %DEPLOY_DIR%...
  15. mkdir "%DEPLOY_DIR%"
  16. )
  17. :: Remove existing ZIP if it exists
  18. if exist "%TARGET_ZIP%" (
  19. echo Removing existing archive...
  20. del "%TARGET_ZIP%"
  21. )
  22. :: Create temporary directory structure for packaging
  23. set TEMP_DIR=%TEMP%\%PLUGIN_NAME%_package
  24. set PLUGIN_TEMP_DIR=%TEMP_DIR%\%PLUGIN_NAME%
  25. :: Clean up any existing temporary directories
  26. if exist "%TEMP_DIR%" rmdir /s /q "%TEMP_DIR%"
  27. mkdir "%TEMP_DIR%"
  28. mkdir "%PLUGIN_TEMP_DIR%"
  29. echo Copying plugin files to temporary directory...
  30. :: Copy all files and directories except excluded ones
  31. for /d %%D in (*) do (
  32. if /i not "%%D"=="@documentation" (
  33. if /i not "%%D"=="@client" (
  34. xcopy "%%D" "%PLUGIN_TEMP_DIR%\%%D\" /E /I /H /Y >nul
  35. )
  36. )
  37. )
  38. :: Copy individual files except the script itself
  39. for %%F in (*.*) do (
  40. if /i not "%%F"=="%SCRIPT_NAME%" (
  41. copy "%%F" "%PLUGIN_TEMP_DIR%\" >nul
  42. )
  43. )
  44. echo Creating ZIP archive...
  45. :: Create ZIP file using PowerShell (this will include the plugin directory)
  46. powershell -Command "Add-Type -AssemblyName System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::CreateFromDirectory('%TEMP_DIR%', '%TARGET_ZIP%')"
  47. :: Clean up temporary directories
  48. rmdir /s /q "%TEMP_DIR%"
  49. :: Verify creation and display result
  50. if exist "%TARGET_ZIP%" (
  51. echo.
  52. echo Package created successfully: %TARGET_ZIP%
  53. echo Size:
  54. for %%A in ("%TARGET_ZIP%") do echo %%~zA bytes
  55. ) else (
  56. echo.
  57. echo ERROR: Failed to create package!
  58. )
  59. echo.
  60. echo Process complete.
  61. endlocal