added development environment setup scripts and pre-commit hook scripts
This commit is contained in:
parent
24582eb2fc
commit
bdb43ef999
6 changed files with 106 additions and 0 deletions
45
scripts/dev.ps1
Executable file
45
scripts/dev.ps1
Executable file
|
@ -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
|
47
scripts/dev.sh
Executable file
47
scripts/dev.sh
Executable file
|
@ -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
|
5
scripts/hooks/pre-commit
Executable file
5
scripts/hooks/pre-commit
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo "pre-commit: Refreshing packwiz"
|
||||
cd src
|
||||
packwiz refresh
|
5
scripts/hooks/pre-commit-windows
Executable file
5
scripts/hooks/pre-commit-windows
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env/pwsh
|
||||
|
||||
Write-Output "pre-commit: Refreshing packwiz"
|
||||
Set-Location src
|
||||
packwiz refresh
|
2
scripts/unsup_setup.ps1
Normal file → Executable file
2
scripts/unsup_setup.ps1
Normal file → Executable file
|
@ -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
|
||||
|
|
2
scripts/unsup_setup.sh
Normal file → Executable file
2
scripts/unsup_setup.sh
Normal file → Executable file
|
@ -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
|
||||
|
|
Reference in a new issue