File tree Expand file tree Collapse file tree 2 files changed +54
-0
lines changed
Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Original file line number Diff line number Diff line change 1+ @ echo off
2+ SETLOCAL
3+
4+ mage -version > nul 2 >& 1
5+ IF %ERRORLEVEL% EQU 0 (
6+ echo Mage is already installed.
7+ GOTO DOWNLOAD
8+ )
9+
10+ go version > nul 2 >& 1
11+ IF NOT %ERRORLEVEL% EQU 0 (
12+ echo Go is not installed. Please install Go and try again.
13+ exit /b 1
14+ )
15+
16+ echo Installing Mage...
17+ go install github.com/magefile/mage@ latest
18+
19+ mage -version > nul 2 >& 1
20+ IF NOT %ERRORLEVEL% EQU 0 (
21+ echo Mage installation failed.
22+ echo Please ensure that %GOPATH% /bin is in your PATH.
23+ exit /b 1
24+ )
25+
26+ echo Mage installed successfully.
27+
28+ :DOWNLOAD
29+ go mod download
30+
31+ ENDLOCAL
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ if [[ " :$PATH :" == * " :$HOME /.local/bin:" * ]]; then
4+ TARGET_DIR=" $HOME /.local/bin"
5+ else
6+ TARGET_DIR=" /usr/local/bin"
7+ echo " Using /usr/local/bin as the installation directory. Might require sudo permissions."
8+ fi
9+
10+ if ! command -v mage & > /dev/null; then
11+ echo " Installing Mage to $TARGET_DIR ..."
12+ GOBIN=$TARGET_DIR go install github.com/magefile/mage@latest
13+ fi
14+
15+ if ! command -v mage & > /dev/null; then
16+ echo " Mage installation failed."
17+ echo " Please ensure that $TARGET_DIR is in your \$ PATH."
18+ exit 1
19+ fi
20+
21+ echo " Mage installed successfully."
22+
23+ go mod download
You can’t perform that action at this time.
0 commit comments