From cff4d3baf685e7bee2743b00da6a57578a056141 Mon Sep 17 00:00:00 2001 From: Alexander Zhirov Date: Fri, 30 May 2025 14:00:48 +0300 Subject: [PATCH 1/2] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D1=81=D0=B1=D0=BE=D1=80=D0=BA=D0=B0=20=D0=B2=20?= =?UTF-8?q?=D0=B8=D0=BD=D1=81=D1=82=D0=B0=D0=BB=D0=BB=D1=8F=D1=86=D0=B8?= =?UTF-8?q?=D0=BE=D0=BD=D0=BD=D1=8B=D0=B9=20=D1=84=D0=B0=D0=B9=D0=BB=20?= =?UTF-8?q?=D0=B4=D0=BB=D1=8F=20Windows?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.ps1 | 103 ++++++++++++++++++++++++++++++++++++++++++ windows.md | 7 +++ windows/snag.bat | 21 +++++++++ windows/snag.iss | 30 ++++++++++++ windows/snag.json.bak | 16 +++++++ 5 files changed, 177 insertions(+) create mode 100644 build.ps1 create mode 100644 windows.md create mode 100644 windows/snag.bat create mode 100644 windows/snag.iss create mode 100644 windows/snag.json.bak diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 0000000..80fc10d --- /dev/null +++ b/build.ps1 @@ -0,0 +1,103 @@ +# PowerShell script to automate building and creating the installer + +# Путь к файлу version_.d +$versionFile = "source/snag/version_.d" + +# Путь к файлу snag.iss +$issFile = "windows/snag.iss" + +# Извлечение snagVersion из version_.d +$content = Get-Content -Path $versionFile -Raw -Encoding UTF8 +if ($content -match 'enum\s+snagVersion\s*=\s*"([^"]+)"') { + $snagVersion = $Matches[1] + Write-Host "Extracted version: $snagVersion" +} else { + Write-Host "Failed to find snagVersion in $versionFile." + exit 1 +} + +# Чтение snag.iss +$issContent = Get-Content -Path $issFile -Raw -Encoding UTF8 + +# Обновление AppVersion +$appVersionPattern = "AppVersion=$snagVersion" +if ($issContent -match [regex]::Escape($appVersionPattern)) { + Write-Host "AppVersion in $issFile is already set to $snagVersion. Skipping update." +} else { + $issContent = $issContent -replace 'AppVersion=version', "AppVersion=$snagVersion" + Write-Host "Updated AppVersion to $snagVersion in $issFile." +} + +# Обновление OutputBaseFileName +$appName = "snag_" +$postfix = "_windows-installer" +$newOutputBaseFileName = "$appName$snagVersion$postfix" +$outputBasePattern = "OutputBaseFileName=$newOutputBaseFileName" +if ($issContent -match [regex]::Escape($outputBasePattern)) { + Write-Host "OutputBaseFileName in $issFile is already set to $newOutputBaseFileName. Skipping update." +} else { + $issContent = $issContent -replace 'OutputBaseFileName=SnagInstaller', "OutputBaseFileName=$newOutputBaseFileName" + Write-Host "Updated OutputBaseFileName to $newOutputBaseFileName in $issFile." +} + +# Сохранение обновленного snag.iss +Set-Content -Path $issFile -Value $issContent -Encoding UTF8 +Write-Host "File $issFile successfully updated." + +# Путь к файлу app.d +$appDFile = "source/app.d" + +# Исходная и целевая строки для замены +$originalString = 'string configFile = argumets.option("config", "snag.json");' +$newString = @' +import std.process : environment; + import std.path : buildPath; + string configFile = argumets.option("config", environment.get("USERPROFILE").buildPath("snag\\snag.json")); +'@ + +# Чтение содержимого файла и замена строки +$content = Get-Content -Path $appDFile -Raw -Encoding UTF8 +if ($content -match [regex]::Escape($newString)) { + Write-Host "The string in $appDFile is already updated. Skipping replacement." +} elseif ($content -match [regex]::Escape($originalString)) { + $content = $content -replace [regex]::Escape($originalString), $newString + Set-Content -Path $appDFile -Value $content -Encoding UTF8 + Write-Host "The string in $appDFile has been successfully replaced." +} else { + Write-Host "The original string in $appDFile was not found." + exit 1 +} + +# Выполнение команды dub build +Write-Host "Starting build with dub..." +dub build --build=release > dub_build.log 2>&1 +if ($LASTEXITCODE -ne 0) { + Write-Host "Error during dub build. Check dub_build.log for details." + exit 1 +} + +# Переход в директорию windows +Write-Host "Changing to the windows/ directory..." +Set-Location -Path "windows" +if (-not $?) { + Write-Host "Failed to change to the windows/ directory." + exit 1 +} + +# Запуск компиляции Inno Setup +Write-Host "Starting Inno Setup compilation..." +& 'C:\Program Files (x86)\Inno Setup 6\ISCC.exe' .\snag.iss > inno_setup.log 2>&1 +if ($LASTEXITCODE -ne 0) { + Write-Host "Error during Inno Setup compilation. Check inno_setup.log for details." + exit 1 +} + +# Выход из директории windows +Write-Host "Changing back to the parent directory..." +Set-Location -Path .. +if (-not $?) { + Write-Host "Failed to change back to the parent directory." + exit 1 +} + +Write-Host "Build and installer compilation completed successfully!" diff --git a/windows.md b/windows.md new file mode 100644 index 0000000..481d5ba --- /dev/null +++ b/windows.md @@ -0,0 +1,7 @@ +# Сборка из под Windows + +Для сборки на Windows необходим установленный [Inno Setup](https://jrsoftware.org/isdl.php). + +``` +.\build.ps1 +``` diff --git a/windows/snag.bat b/windows/snag.bat new file mode 100644 index 0000000..d7f710b --- /dev/null +++ b/windows/snag.bat @@ -0,0 +1,21 @@ +@echo off + +chcp 65001 > nul + +set "SCRIPT_DIR=%~dp0" +set "SNAG_PATH=%SCRIPT_DIR%" +set "PATH=%PATH%;%SNAG_PATH%" + +echo ----------------------------------------------- +echo Snag Application Launcher +echo ----------------------------------------------- +echo. +echo NOTE: Ensure the config file exists at: +echo "%USERPROFILE%\snag\snag.json" +echo. +echo To get started, type: snag --help +echo ----------------------------------------------- +echo. + +cd /d "%USERPROFILE%" +cmd /k diff --git a/windows/snag.iss b/windows/snag.iss new file mode 100644 index 0000000..bc4a667 --- /dev/null +++ b/windows/snag.iss @@ -0,0 +1,30 @@ +; Сценарий для Inno Setup +[Setup] +AppName=Snag +AppVersion=version +DefaultDirName={commonpf}\snag +DefaultGroupName=Snag +OutputDir=Output +OutputBaseFileName=SnagInstaller +Compression=lzma +SolidCompression=yes +LicenseFile=../LICENSE + +[Languages] +Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl" + +[Files] +Source: "../bin/snag.exe"; DestDir: "{app}"; Flags: ignoreversion +Source: "snag.bat"; DestDir: "{app}"; Flags: ignoreversion +Source: "snag.json.bak"; DestDir: "{app}"; Flags: ignoreversion +Source: "../LICENSE"; DestDir: "{app}"; Flags: ignoreversion + +[Icons] +Name: "{group}\Snag"; Filename: "{app}\snag.bat" +Name: "{group}\{cm:UninstallProgram,Snag}"; Filename: "{uninstallexe}" + +[Run] +Filename: "{app}\snag.bat"; Description: "{cm:LaunchProgram,Snag}"; Flags: nowait postinstall skipifsilent + +[CustomMessages] +russian.LaunchProgram=Запустить Snag diff --git a/windows/snag.json.bak b/windows/snag.json.bak new file mode 100644 index 0000000..4cf4d52 --- /dev/null +++ b/windows/snag.json.bak @@ -0,0 +1,16 @@ +{ + "git": "", + "project": "", + "email": "", + "author": "", + "presnag": [ + ], + "postsnag": [ + ], + "rules": { + "tracking": [ + ], + "ignore": [ + ] + } +} From 6c1f19d9033f47b11bea9597406fc5f8cb3e9f1e Mon Sep 17 00:00:00 2001 From: Alexander Zhirov Date: Tue, 3 Jun 2025 02:25:40 +0300 Subject: [PATCH 2/2] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B0=20=D1=81=D0=B1=D0=BE=D1=80=D0=BA=D0=B0=20=D0=B8=D0=BD?= =?UTF-8?q?=D1=81=D1=82=D0=B0=D0=BB=D0=BB=D1=8F=D1=86=D0=B8=D0=BE=D0=BD?= =?UTF-8?q?=D0=BD=D0=BE=D0=B3=D0=BE=20=D0=BF=D0=B0=D0=BA=D0=B5=D1=82=D0=B0?= =?UTF-8?q?=20-=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B0?= =?UTF-8?q?=20=D1=80=D0=B0=D1=81=D1=88=D0=B8=D1=80=D0=B5=D0=BD=D0=BD=D1=8B?= =?UTF-8?q?=D0=B9=20=D1=84=D0=BE=D1=80=D0=BC=D0=B0=D1=82=20=D0=B2=D0=B5?= =?UTF-8?q?=D1=80=D1=81=D0=B8=D0=B8=20=D0=BF=D1=80=D0=BE=D0=B3=D1=80=D0=B0?= =?UTF-8?q?=D0=BC=D0=BC=D1=8B=20-=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D0=B4=D0=BE=D0=BA=D1=83=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D1=82=D0=B0=D1=86=D0=B8=D1=8F=20=D0=B2=20=D0=B2=D0=B8=D0=B4?= =?UTF-8?q?=D0=B5=20=D1=81=D0=BA=D0=BE=D0=BD=D0=B2=D0=B5=D1=80=D1=82=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=BD=D0=BE=D0=B9=20README.md=20?= =?UTF-8?q?=D0=B2=20html=20=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86?= =?UTF-8?q?=D1=83=20-=20=D0=A4=D0=BB=D0=B0=D0=B3=20AddGitHash=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20=D0=B8=D1=81=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20git=20=D1=85=D1=8D=D1=88=D0=B0?= =?UTF-8?q?=20=D0=B2=20=D0=BA=D0=B0=D1=87=D0=B5=D1=81=D1=82=D0=B2=D0=B5=20?= =?UTF-8?q?=D0=B4=D0=BE=D0=BF=D0=BE=D0=BB=D0=BD=D0=B5=D0=BD=D0=B8=D1=8F=20?= =?UTF-8?q?=D0=BA=20=D0=B2=D0=B5=D1=80=D1=81=D0=B8=D0=B8=20=D0=BF=D1=80?= =?UTF-8?q?=D0=BE=D0=B3=D1=80=D0=B0=D0=BC=D0=BC=D1=8B=20-=20=D0=90=D0=B2?= =?UTF-8?q?=D1=82=D0=BE=D0=BE=D1=87=D0=B8=D1=89=D0=B5=D0=BD=D0=B8=D0=B5=20?= =?UTF-8?q?=D0=BF=D0=BE=D1=81=D0=BB=D0=B5=20=D1=81=D0=B1=D0=BE=D1=80=D0=BA?= =?UTF-8?q?=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.ps1 | 233 +++++++++++++++++++++++++++++++++++++++------- windows.md | 4 +- windows/snag.iss | 5 +- windows/style.css | 4 + 4 files changed, 207 insertions(+), 39 deletions(-) create mode 100644 windows/style.css diff --git a/build.ps1 b/build.ps1 index 80fc10d..c25a8cc 100644 --- a/build.ps1 +++ b/build.ps1 @@ -1,31 +1,111 @@ -# PowerShell script to automate building and creating the installer +param ( + [switch]$AddGitHash +) -# Путь к файлу version_.d -$versionFile = "source/snag/version_.d" +[Console]::OutputEncoding = [System.Text.Encoding]::UTF8 + +# Путь к файлам +$originalVersionFile = "source/snag/version_.d" +$backupVersionFile = "source/snag/version_.d.bak" + +# Создание backup файла, если он не существует +try { + if (-not (Test-Path $backupVersionFile)) { + Copy-Item -Path $originalVersionFile -Destination $backupVersionFile -Force + Write-Host "Created backup: Copied $originalVersionFile to $backupVersionFile" -ForegroundColor Green + } +} catch { + Write-Host "Error creating backup file: $_" -ForegroundColor Red + exit 1 +} + +# Чтение версии из backup файла +try { + $content = Get-Content -Path $backupVersionFile -Raw -Encoding UTF8 -ErrorAction Stop + if ($content -match 'enum\s+snagVersion\s*=\s*"([^"]+)"') { + $baseVersion = $Matches[1] + Write-Host "Extracted base version: $baseVersion" -ForegroundColor Cyan + } else { + Write-Host "Failed to find snagVersion in $backupVersionFile" -ForegroundColor Red + exit 1 + } +} catch { + Write-Host "Error reading ${backupVersionFile}: $_" -ForegroundColor Red + exit 1 +} + +# Получение текущей даты и времени в формате yyddd.HHmm +$dateTime = Get-Date -Format "yy$(Get-Date -UFormat %j).HHmm" + +# Получение git хэша, если требуется +$gitHash = "" +if ($AddGitHash) { + try { + if (Get-Command git -ErrorAction SilentlyContinue) { + $gitHash = git rev-parse --short HEAD + if ($LASTEXITCODE -eq 0) { + Write-Host "Git short hash: $gitHash" -ForegroundColor Cyan + } else { + Write-Host "Git command failed, proceeding without hash" -ForegroundColor Yellow + } + } else { + Write-Host "Git not found, proceeding without hash" -ForegroundColor Cyan + } + } catch { + Write-Host "Error executing git command: $_" -ForegroundColor Red + Write-Host "Proceeding without git hash" -ForegroundColor Yellow + } +} else { + Write-Host "Git hash inclusion disabled by parameter" -ForegroundColor Cyan +} + +# Разделение базовой версии на основную часть и суффикс +$versionParts = $baseVersion -split '-' +$mainVersion = $versionParts[0] # Основная версия, например, "0.1.0" +$suffix = if ($versionParts.Count -gt 1) { "-$($versionParts[1])" } else { "" } # Суффикс, например, "-alpha.2" или пусто + +# Формирование итоговой версии +$snagVersion = "${mainVersion}.${dateTime}${suffix}" +if ($AddGitHash -and $gitHash) { + $snagVersion = "${snagVersion}-${gitHash}" +} +Write-Host "Final version: $snagVersion" -ForegroundColor Cyan + +# Замена версии в файле version_.d +try { + $content = Get-Content -Path $originalVersionFile -Raw -Encoding UTF8 -ErrorAction Stop + $newContent = $content -replace 'enum\s+snagVersion\s*=\s*"[^"]+"', "enum snagVersion = ""$snagVersion""" + Set-Content -Path $originalVersionFile -Value $newContent -Encoding UTF8 -ErrorAction Stop + Write-Host "Updated $originalVersionFile with new version: $snagVersion" -ForegroundColor Green +} catch { + Write-Host "Error updating ${originalVersionFile}: $_" -ForegroundColor Red + exit 1 +} # Путь к файлу snag.iss $issFile = "windows/snag.iss" -# Извлечение snagVersion из version_.d -$content = Get-Content -Path $versionFile -Raw -Encoding UTF8 -if ($content -match 'enum\s+snagVersion\s*=\s*"([^"]+)"') { - $snagVersion = $Matches[1] - Write-Host "Extracted version: $snagVersion" -} else { - Write-Host "Failed to find snagVersion in $versionFile." +# Проверка существования файла snag.iss +if (-not (Test-Path $issFile)) { + Write-Host "File $issFile does not exist." -ForegroundColor Red exit 1 } # Чтение snag.iss -$issContent = Get-Content -Path $issFile -Raw -Encoding UTF8 +try { + $issContent = Get-Content -Path $issFile -Raw -Encoding UTF8 -ErrorAction Stop +} catch { + Write-Host "Error reading ${issFile}: $_" -ForegroundColor Red + exit 1 +} # Обновление AppVersion $appVersionPattern = "AppVersion=$snagVersion" if ($issContent -match [regex]::Escape($appVersionPattern)) { - Write-Host "AppVersion in $issFile is already set to $snagVersion. Skipping update." + Write-Host "AppVersion in $issFile is already set to $snagVersion. Skipping update." -ForegroundColor Blue } else { $issContent = $issContent -replace 'AppVersion=version', "AppVersion=$snagVersion" - Write-Host "Updated AppVersion to $snagVersion in $issFile." + Write-Host "Updated AppVersion to $snagVersion in $issFile." -ForegroundColor Green } # Обновление OutputBaseFileName @@ -34,19 +114,30 @@ $postfix = "_windows-installer" $newOutputBaseFileName = "$appName$snagVersion$postfix" $outputBasePattern = "OutputBaseFileName=$newOutputBaseFileName" if ($issContent -match [regex]::Escape($outputBasePattern)) { - Write-Host "OutputBaseFileName in $issFile is already set to $newOutputBaseFileName. Skipping update." + Write-Host "OutputBaseFileName in $issFile is already set to $newOutputBaseFileName. Skipping update." -ForegroundColor Blue } else { $issContent = $issContent -replace 'OutputBaseFileName=SnagInstaller', "OutputBaseFileName=$newOutputBaseFileName" - Write-Host "Updated OutputBaseFileName to $newOutputBaseFileName in $issFile." + Write-Host "Updated OutputBaseFileName to $newOutputBaseFileName in $issFile." -ForegroundColor Green } # Сохранение обновленного snag.iss -Set-Content -Path $issFile -Value $issContent -Encoding UTF8 -Write-Host "File $issFile successfully updated." +try { + Set-Content -Path $issFile -Value $issContent -Encoding UTF8 -ErrorAction Stop + Write-Host "File $issFile successfully updated." -ForegroundColor Green +} catch { + Write-Host "Error writing to ${issFile}: $_" -ForegroundColor Red + exit 1 +} # Путь к файлу app.d $appDFile = "source/app.d" +# Проверка существования файла app.d +if (-not (Test-Path $appDFile)) { + Write-Host "File $appDFile does not exist." -ForegroundColor Red + exit 1 +} + # Исходная и целевая строки для замены $originalString = 'string configFile = argumets.option("config", "snag.json");' $newString = @' @@ -56,48 +147,118 @@ import std.process : environment; '@ # Чтение содержимого файла и замена строки -$content = Get-Content -Path $appDFile -Raw -Encoding UTF8 -if ($content -match [regex]::Escape($newString)) { - Write-Host "The string in $appDFile is already updated. Skipping replacement." -} elseif ($content -match [regex]::Escape($originalString)) { - $content = $content -replace [regex]::Escape($originalString), $newString - Set-Content -Path $appDFile -Value $content -Encoding UTF8 - Write-Host "The string in $appDFile has been successfully replaced." -} else { - Write-Host "The original string in $appDFile was not found." +try { + $content = Get-Content -Path $appDFile -Raw -Encoding UTF8 -ErrorAction Stop + if ($content -match [regex]::Escape($newString)) { + Write-Host "The string in $appDFile is already updated. Skipping replacement." -ForegroundColor Blue + } elseif ($content -match [regex]::Escape($originalString)) { + $content = $content -replace [regex]::Escape($originalString), $newString + Set-Content -Path $appDFile -Value $content -Encoding UTF8 -ErrorAction Stop + Write-Host "The string in $appDFile has been successfully replaced." -ForegroundColor Green + } else { + Write-Host "The original string in $appDFile was not found." -ForegroundColor Red + exit 1 + } +} catch { + Write-Host "Error processing ${appDFile}: $_" -ForegroundColor Red + exit 1 +} + +# Проверяем наличие dub в системе +try { + Get-Command dub -ErrorAction Stop | Select-Object -ExpandProperty Source > $null 2>&1 +} catch { + Write-Host "Error: Pandoc is not installed or not in PATH" -ForegroundColor Red exit 1 } # Выполнение команды dub build -Write-Host "Starting build with dub..." +Write-Host "Starting build with dub..." -ForegroundColor Green dub build --build=release > dub_build.log 2>&1 if ($LASTEXITCODE -ne 0) { - Write-Host "Error during dub build. Check dub_build.log for details." + Write-Host "Error during dub build. Check dub_build.log for details." -ForegroundColor Red exit 1 } # Переход в директорию windows -Write-Host "Changing to the windows/ directory..." +Write-Host "Changing to the windows/ directory..." -ForegroundColor Green Set-Location -Path "windows" if (-not $?) { - Write-Host "Failed to change to the windows/ directory." + Write-Host "Failed to change to the windows/ directory." -ForegroundColor Red + exit 1 +} + +# Проверка существования файлов для pandoc +$readmeFile = "../README.md" +$cssFile = "style.css" +$outputHtml = "readme.html" + +if (-not (Test-Path $readmeFile)) { + Write-Host "File $readmeFile does not exist." -ForegroundColor Red + exit 1 +} +if (-not (Test-Path $cssFile)) { + Write-Host "File $cssFile does not exist." -ForegroundColor Red + exit 1 +} + +# Проверяем наличие pandoc в системе +try { + Get-Command pandoc -ErrorAction Stop | Select-Object -ExpandProperty Source > $null 2>&1 +} catch { + Write-Host "Error: Pandoc is not installed or not in PATH" -ForegroundColor Red + exit 1 +} + +# Выполнение команды pandoc +Write-Host "Converting README.md to readme.html using pandoc..." -ForegroundColor Green +pandoc -s -o $outputHtml $readmeFile --css=$cssFile > pandoc.log 2>&1 +if ($LASTEXITCODE -ne 0) { + Write-Host "Error during pandoc conversion. Check pandoc.log for details." -ForegroundColor Red + exit 1 +} +Write-Host "Successfully converted README.md to $outputHtml." -ForegroundColor Green + +# Проверка существования Inno Setup +$innoSetupPath = 'C:\Program Files (x86)\Inno Setup 6\ISCC.exe' +if (-not (Test-Path $innoSetupPath)) { + Write-Host "Inno Setup compiler not found at $innoSetupPath." exit 1 } # Запуск компиляции Inno Setup -Write-Host "Starting Inno Setup compilation..." -& 'C:\Program Files (x86)\Inno Setup 6\ISCC.exe' .\snag.iss > inno_setup.log 2>&1 +Write-Host "Starting Inno Setup compilation..." -ForegroundColor Green +& $innoSetupPath .\snag.iss > inno_setup.log 2>&1 if ($LASTEXITCODE -ne 0) { - Write-Host "Error during Inno Setup compilation. Check inno_setup.log for details." + Write-Host "Error during Inno Setup compilation. Check inno_setup.log for details." -ForegroundColor Red exit 1 } # Выход из директории windows -Write-Host "Changing back to the parent directory..." +Write-Host "Changing back to the parent directory..." -ForegroundColor Green Set-Location -Path .. if (-not $?) { - Write-Host "Failed to change back to the parent directory." + Write-Host "Failed to change back to the parent directory." -ForegroundColor Red exit 1 } -Write-Host "Build and installer compilation completed successfully!" +try { + # Выполняем git restore (отмена изменений в отслеживаемых файлах) + Write-Host "Running 'git restore .'..." -ForegroundColor Cyan + git restore . + if ($LASTEXITCODE -ne 0) { + throw "git restore failed with exit code $LASTEXITCODE" + } + # Выполняем git clean (удаление неотслеживаемых файлов) + Write-Host "Running 'git clean -f -d'..." -ForegroundColor Cyan + git clean -f -d | ForEach-Object { Write-Host $_ -ForegroundColor Yellow } + if ($LASTEXITCODE -ne 0) { + throw "git clean failed with exit code $LASTEXITCODE" + } + Write-Host "Git cleanup completed successfully!" -ForegroundColor Green +} +catch { + Write-Host "ERROR: $_" -ForegroundColor Red +} + +Write-Host "Build and installer compilation completed successfully!" -ForegroundColor Green diff --git a/windows.md b/windows.md index 481d5ba..77752d0 100644 --- a/windows.md +++ b/windows.md @@ -1,7 +1,7 @@ # Сборка из под Windows -Для сборки на Windows необходим установленный [Inno Setup](https://jrsoftware.org/isdl.php). +Для сборки на Windows необходим установленный [Inno Setup](https://jrsoftware.org/isdl.php) и для документации [pandoc](https://pandoc.org/). ``` -.\build.ps1 +.\build.ps1 -AddGitHash ``` diff --git a/windows/snag.iss b/windows/snag.iss index bc4a667..3832241 100644 --- a/windows/snag.iss +++ b/windows/snag.iss @@ -1,4 +1,4 @@ -; Сценарий для Inno Setup +; Сценарий для Inno Setup [Setup] AppName=Snag AppVersion=version @@ -18,9 +18,12 @@ Source: "../bin/snag.exe"; DestDir: "{app}"; Flags: ignoreversion Source: "snag.bat"; DestDir: "{app}"; Flags: ignoreversion Source: "snag.json.bak"; DestDir: "{app}"; Flags: ignoreversion Source: "../LICENSE"; DestDir: "{app}"; Flags: ignoreversion +Source: "style.css"; DestDir: "{app}\doc\"; Flags: ignoreversion +Source: "readme.html"; DestDir: "{app}\doc\"; Flags: ignoreversion [Icons] Name: "{group}\Snag"; Filename: "{app}\snag.bat" +Name: "{group}\README"; Filename: "{app}\doc\readme.html" Name: "{group}\{cm:UninstallProgram,Snag}"; Filename: "{uninstallexe}" [Run] diff --git a/windows/style.css b/windows/style.css new file mode 100644 index 0000000..40e0c5d --- /dev/null +++ b/windows/style.css @@ -0,0 +1,4 @@ +body { font-family: Arial, sans-serif; margin: 20px; } +h1, h2, h3 { color: #333; } +pre { background: #f4f4f4; padding: 10px; border-radius: 5px; } +code { font-family: Consolas, monospace; }