rename, add Makefile rename support
All checks were successful
Build and Publish / release (push) Has been skipped
Build and Publish / check-chart (push) Successful in 9s
Build and Publish / helm-release (push) Has been skipped

This commit is contained in:
2025-03-31 10:13:02 -04:00
parent 95aa1e47d1
commit c8e461729f
12 changed files with 55 additions and 27 deletions

View File

@ -7,7 +7,7 @@ PROTO_DIRS := $(wildcard proto/demo/app/*) # TODO: Update path (probably not dem
PLATFORMS := linux/amd64 linux/arm64 darwin/amd64 darwin/arm64
OUTPUT_DIR := bin
VER_PKG := gitea.libretechconsulting.com/rmcguire/go-app/pkg/config.Version
DOCKER_IMG := gitea.libretechconsulting.com/rmcguire/go-http-server-with-otel
GIT_REPO := gitea.libretechconsulting.com/rmcguire/go-server-with-otel
all: proto test build docker
@ -37,12 +37,12 @@ schema:
go run . -schema > contrib/schema.json
docker:
@echo "Building Docker image $(DOCKER_IMG):$(VERSION)"
@echo "Building Docker image $(GIT_REPO):$(VERSION)"
docker build \
--build-arg VER_PKG=$(VER_PKG) \
--build-arg VERSION=$(VERSION) \
-t $(DOCKER_IMG):$(VERSION) .
docker push $(DOCKER_IMG):$(VERSION)
-t $(GIT_REPO):$(VERSION) .
docker push $(GIT_REPO):$(VERSION)
install:
go install -v -ldflags "-X $(VER_PKG)=$(VERSION)" .
@ -59,3 +59,18 @@ check_protoc:
echo "Error: protoc-gen-go-grpc not found in PATH"; \
exit 1; \
fi
rename:
@echo "Current module path: $(GIT_REPO)"
@echo "Usage: make rename NAME=your/new/module/name"
@if [ -z "$(NAME)" ]; then \
echo "No name provided. Aborting."; \
exit 1; \
fi
@echo "New name: $(NAME)"
@echo "Are you sure you want to proceed? (y/N): " && read CONFIRM && if [ "$$CONFIRM" != "y" ] && [ "$$CONFIRM" != "Y" ]; then \
echo "Aborted."; \
exit 1; \
fi
@find . -type f \( -name '*.go' -o -name 'go.mod' -o -name 'go.sum' -o -name '*.proto' -o -name 'Makefile' \) -exec sed -i "s|$(GIT_REPO)|$(NAME)|g" {} +
@echo "Project renamed to $(NAME)"