Skip to content

Commit e4b01a9

Browse files
committed
feat: add install scripts
1 parent a744943 commit e4b01a9

2 files changed

Lines changed: 43 additions & 2 deletions

File tree

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
github.com/cpuguy83/go-md2man/v2 v2.0.6 h1:XJtiaUW6dEEqVuZiMTn1ldk455QWwEIsMIJlo5vtkx0=
12
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
3+
github.com/creack/pty v1.1.9 h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w=
24
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
35
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
46
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
@@ -11,6 +13,7 @@ github.com/jgfranco17/dev-tooling-go v0.0.3 h1:lDjQCd1RC4t/kEQBPMQ+HOJnpNOOuUB0G
1113
github.com/jgfranco17/dev-tooling-go v0.0.3/go.mod h1:cjjYukhRfHJ+uE3IqnVVYrvrIy7rG13wY7rjJqGPHwM=
1214
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
1315
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
16+
github.com/kr/pty v1.1.1 h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw=
1417
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
1518
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
1619
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
@@ -22,6 +25,7 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE
2225
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
2326
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
2427
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
28+
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
2529
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
2630
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
2731
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=

justfile

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Devops: Development scripts
2+
3+
INSTALL_PATH := "$HOME/.local"
4+
15
# Default command
26
_default:
37
@just --list --unsorted
@@ -18,12 +22,45 @@ test:
1822
go test -cover ./...
1923

2024
# Build the binary
21-
build:
25+
build os="linux":
2226
#!/usr/bin/env bash
27+
# Detect OS and architecture
28+
case "$(uname -s)" in
29+
Linux*) OS="linux" ;;
30+
Darwin*) OS="darwin" ;;
31+
*) echo "Error: Unsupported OS (${OS})"; exit 1 ;;
32+
esac
33+
case "$(uname -m)" in
34+
x86_64) ARCH="amd64" ;;
35+
aarch64) ARCH="arm64" ;;
36+
arm64) ARCH="arm64" ;;
37+
*) echo "Error: Unsupported architecture (${ENV_ARCH})"; exit 1 ;;
38+
esac
39+
40+
echo "Building devops for ${OS}/${ARCH}..."
2341
go mod download all
24-
CGO_ENABLED=0 GOOS=linux go build -o ./devops .
42+
CGO_ENABLED=0 GOOS="${OS}" GOARCH="${ARCH}" go build -o ./devops ./cmd/devops
2543
echo "Built binary for devops successfully!"
2644

45+
# Install the binary locally
46+
install-local: build
47+
#!/usr/bin/env bash
48+
set -eux
49+
echo "Installing devops locally..."
50+
BIN_PATH="{{ INSTALL_PATH }}/bin/devops"
51+
cp ./devops "${BIN_PATH}"
52+
chmod +x "${BIN_PATH}"
53+
echo "Installed devops locally!"
54+
55+
# Remove the local binary
56+
uninstall-local:
57+
#!/usr/bin/env bash
58+
set -eux
59+
echo "Uninstalling devops..."
60+
BIN_PATH="{{ INSTALL_PATH }}/bin/devops"
61+
rm "${BIN_PATH}"
62+
echo "Uninstalled devops!"
63+
2764
# Update the project dependencies
2865
update-deps:
2966
@echo "Updating project dependencies..."

0 commit comments

Comments
 (0)