diff --git a/scripts/dev.ps1 b/scripts/dev.ps1 new file mode 100755 index 0000000..5de8828 --- /dev/null +++ b/scripts/dev.ps1 @@ -0,0 +1,45 @@ +# 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 diff --git a/scripts/dev.sh b/scripts/dev.sh new file mode 100755 index 0000000..424c596 --- /dev/null +++ b/scripts/dev.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +# Function to install packwiz and add it to the system path +install_packwiz() { + # Download packwiz executable + wget https://seafsh.cc/u/O5JTlL -O packwiz + + # Move packwiz executable to a system directory (you may need sudo) + sudo mv packwiz /usr/local/bin/packwiz + + # Add packwiz to the system path + echo 'export PATH="$PATH:/usr/local/bin"' >> ~/.bashrc + source ~/.bashrc + + # Generate autocompletion script + packwiz completion bash > ~/.packwiz + echo 'source ~/.packwiz' >> ~/.bashrc +} + +# Function to create symlink for pre-commit hook +create_symlink() { + # Check if .git/hooks directory exists + if [ ! -d ".git/hooks" ]; then + echo "Error: .git/hooks directory does not exist" + exit 1 + fi + + # Create symlink for pre-commit hook + ln -s "$(pwd)/scripts/hooks/pre-commit" "$(pwd)/.git/hooks/pre-commit" + + # Verify symlink creation + ls -l .git/hooks/pre-commit +} + +# Main function +main() { + # Install packwiz + install_packwiz + + # Create symlink for pre-commit hook + create_symlink + + echo "Development environment setup complete!" +} + +# Execute main function +main diff --git a/scripts/hooks/pre-commit b/scripts/hooks/pre-commit new file mode 100755 index 0000000..3d3c051 --- /dev/null +++ b/scripts/hooks/pre-commit @@ -0,0 +1,5 @@ +#!/bin/sh + +echo "pre-commit: Refreshing packwiz" +cd src +packwiz refresh diff --git a/scripts/hooks/pre-commit-windows b/scripts/hooks/pre-commit-windows new file mode 100755 index 0000000..b14fed1 --- /dev/null +++ b/scripts/hooks/pre-commit-windows @@ -0,0 +1,5 @@ +#!/usr/bin/env/pwsh + +Write-Output "pre-commit: Refreshing packwiz" +Set-Location src +packwiz refresh diff --git a/scripts/unsup_setup.ps1 b/scripts/unsup_setup.ps1 old mode 100644 new mode 100755 index fbe6e79..a1b6945 --- a/scripts/unsup_setup.ps1 +++ b/scripts/unsup_setup.ps1 @@ -1,2 +1,4 @@ +#!/usr/bin/env/pwsh + Invoke-WebRequest -OutFile unsup.jar -Uri https://git.sleeping.town/attachments/7edb17a2-e43f-4789-8bae-6140cbe98311 Invoke-WebRequest -OutFile unsup.ini -Uri https://www.coastalcommits.com/GalacticFactory/GalacticFactory/raw/branch/master/unsup.ini diff --git a/scripts/unsup_setup.sh b/scripts/unsup_setup.sh old mode 100644 new mode 100755 index 778ade5..a35bcef --- a/scripts/unsup_setup.sh +++ b/scripts/unsup_setup.sh @@ -1,2 +1,4 @@ +#!/bin/sh + wget -O unsup.jar https://git.sleeping.town/attachments/7edb17a2-e43f-4789-8bae-6140cbe98311 wget -O unsup.ini https://www.coastalcommits.com/GalacticFactory/GalacticFactory/raw/branch/master/unsup.ini