schon/scripts/Windows/install.ps1
Egor fureunoir Gorbunov 6ee3870ab0 Features: 1) Add a management command to fix product stock prices; 2) Introduce 'products' field to CategoryType in GraphQL schema to fetch products associated with a category; 3) Enable GraphQL resolvers to utilize type hinting for better clarity.
Fixes: 1) Correct multiple unaligned code blocks in various Python scripts and GraphQL resolvers; 2) Improve condition formatting for readability in mutations and queries; 3) Resolve missing related_name in product model.

Extra: Simplify and refactor Windows scripts removing legacy spinner logic for clarity and better user feedback; adjust spacing, comments, and formatting across various files; update imports for unused QuerySet.
2025-06-17 11:13:11 +03:00

61 lines
1.8 KiB
PowerShell

#!/usr/bin/env pwsh
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
if (-not (Test-Path -Path ".\evibes" -PathType Container))
{
Write-Host "❌ Please run this script from the project's root (where the 'evibes' directory lives)." -ForegroundColor Red
exit 1
}
$purple = "`e[38;2;121;101;209m"
$reset = "`e[0m"
$artPath = Join-Path (Split-Path -Parent $MyInvocation.MyCommand.Definition) '..\ASCII_ART_EVIBES'
if (-not (Test-Path $artPath))
{
Write-Host "❌ Could not find ASCII art at $artPath" -ForegroundColor Red
exit 1
}
Get-Content -Raw -Path $artPath | ForEach-Object { Write-Host "$purple$_$reset" }
Write-Host "`n by WISELESS TEAM`n" -ForegroundColor Gray
if (-not (Test-Path '.env'))
{
Write-Warning ".env file not found. Exiting without running Docker steps."
exit 0
}
$cpuCount = [Environment]::ProcessorCount
if ($cpuCount -lt 4)
{
exit 1
}
$totalMemBytes = (Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory
$totalMemGB = [Math]::Round($totalMemBytes / 1GB, 2)
if ($totalMemGB -lt 6)
{
exit 1
}
$currentDrive = Split-Path -Qualifier $PWD
$driveLetter = $currentDrive.Substring(0, 1)
$freeGB = [Math]::Round((Get-PSDrive -Name $driveLetter).Free / 1GB, 2)
if ($freeGB -lt 20)
{
exit 1
}
Write-Host "System requirements met: CPU cores=$cpuCount, RAM=${totalMemGB}GB, FreeDisk=${freeGB}GB" -ForegroundColor Green
Write-Host "Pulling images" -ForegroundColor Magenta
docker compose pull
Write-Host "Images pulled successfully" -ForegroundColor Green
Write-Host "Building images" -ForegroundColor Magenta
docker compose build
Write-Host "Images built successfully" -ForegroundColor Green
Write-Host ""
Write-Host "You can now use run.ps1 script." -ForegroundColor Cyan