This repository has been archived on 2025-03-02. You can view files and clone it, but cannot push or open issues or pull requests.
GalacticFactory-Legacy/scripts/dev.ps1
SeaswimmerTheFsh bdb43ef999
All checks were successful
Autotagger / Autotagger (push) Successful in 6s
Build / Export Files (push) Successful in 7s
Build / Documentation (push) Successful in 20s
added development environment setup scripts and pre-commit hook scripts
2024-03-23 21:24:05 -04:00

45 lines
1.4 KiB
PowerShell
Executable file

# Function to install packwiz and add it to the system path
function Install-Packwiz {
# Download packwiz executable
Invoke-WebRequest -Uri "https://seafsh.cc/u/d4R3lH.exe" -OutFile "packwiz.exe"
# Move packwiz executable to a system directory
Move-Item -Path ".\packwiz.exe" -Destination "${env:ProgramFiles}\packwiz\packwiz.exe"
# Add packwiz directory to the system path
$path = [Environment]::GetEnvironmentVariable("Path", "Machine")
$packwizPath = "${env:ProgramFiles}\packwiz"
if ($path -notlike "*$packwizPath*") {
[Environment]::SetEnvironmentVariable("Path", "$path;$packwizPath", "Machine")
}
# Verify installation
& "${env:ProgramFiles}\packwiz\packwiz.exe" --version
}
# Function to create symlink for pre-commit hook
function Create-Symlink {
# Check if .git/hooks directory exists
$gitHooksDir = "$PSScriptRoot\.git\hooks"
if (-not (Test-Path $gitHooksDir)) {
Write-Error "Error: .git/hooks directory does not exist"
exit 1
}
# Create symlink for pre-commit hook
New-Item -ItemType SymbolicLink -Path "$gitHooksDir\pre-commit" -Target "$PSScriptRoot\scripts\hooks\pre-commit-windows" -Force
}
# Main function
function Main {
# Install packwiz
Install-Packwiz
# Create symlink for pre-commit hook
Create-Symlink
Write-Host "Script execution completed successfully!"
}
# Execute main function
Main