Fixed binaries
This commit is contained in:
parent
6032b9ab17
commit
9a2eb9b1a6
7 changed files with 66 additions and 60 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -6,3 +6,4 @@ tmp/
|
|||
*.rdb
|
||||
.DS_Store
|
||||
tailwind.config.js
|
||||
lib/stylegen/tw
|
||||
|
|
84
Makefile
84
Makefile
|
@ -1,10 +1,3 @@
|
|||
# Colors
|
||||
CYAN := \033[36m
|
||||
YELLOW := \033[33m
|
||||
GREEN := \033[32m
|
||||
RED := \033[31m
|
||||
RESET := \033[0m
|
||||
|
||||
# Emoji
|
||||
CHECK := ✅
|
||||
BUILD := 🔨
|
||||
|
@ -17,8 +10,8 @@ WARN := ⚠️
|
|||
DOCS := 📚
|
||||
|
||||
# Variables
|
||||
BINARY_NAME := goth.stack
|
||||
DOCKER_IMAGE := goth-stack
|
||||
BINARY_NAME := atri.dad
|
||||
DOCKER_IMAGE := atri-dot-dad
|
||||
GO_FILES := $(wildcard *.go)
|
||||
CSS_INPUT := lib/stylegen/base.css
|
||||
CSS_OUTPUT := public/css/styles.css
|
||||
|
@ -34,109 +27,108 @@ endif
|
|||
.PHONY: all build clean run dev stylegen docker-dev docker-build docker-run test help reset ensure-swag
|
||||
|
||||
help:
|
||||
@echo "$(CYAN)Available commands:$(RESET)"
|
||||
@echo "$(YELLOW)make clean$(RESET) - Remove build artifacts"
|
||||
@echo "$(YELLOW)make reset$(RESET) - Clean and reset the project to initial state"
|
||||
@echo "$(YELLOW)make build$(RESET) - Generate CSS, docs, and build Go binary"
|
||||
@echo "$(YELLOW)make run$(RESET) - Build and run the binary"
|
||||
@echo "$(YELLOW)make dev$(RESET) - Run in development mode"
|
||||
@echo "$(YELLOW)make docker-dev$(RESET)- Run development environment in Docker"
|
||||
@echo "$(YELLOW)make docker-run$(RESET)- Run production container"
|
||||
@echo "$(YELLOW)make test$(RESET) - Run tests"
|
||||
@echo "$(YELLOW)make prod$(RESET) - Full production build"
|
||||
@echo "Available commands:"
|
||||
@echo "make clean - Remove build artifacts"
|
||||
@echo "make reset - Clean and reset the project to initial state"
|
||||
@echo "make build - Generate CSS, docs, and build Go binary"
|
||||
@echo "make run - Build and run the binary"
|
||||
@echo "make dev - Run in development mode"
|
||||
@echo "make docker-dev - Run development environment in Docker"
|
||||
@echo "make docker-run - Run production container"
|
||||
@echo "make test - Run tests"
|
||||
@echo "make prod - Full production build"
|
||||
|
||||
# Check if swag is installed
|
||||
ensure-swag:
|
||||
@command -v swag >/dev/null 2>&1 || { \
|
||||
echo "$(WARN) $(RED)Swagger CLI (swag) is not installed. Installing...$(RESET)"; \
|
||||
echo "$(WARN) Swagger CLI (swag) is not installed. Installing..."; \
|
||||
go install github.com/swaggo/swag/cmd/swag@latest; \
|
||||
}
|
||||
|
||||
reset:
|
||||
@echo "$(CLEAN) $(CYAN)Performing complete project reset...$(RESET)"
|
||||
@echo "$(CLEAN) Performing complete project reset..."
|
||||
@rm -f $(BINARY_NAME)
|
||||
@rm -f $(CSS_OUTPUT)
|
||||
@rm -rf public/css/*
|
||||
@rm -f tailwind.config.js
|
||||
@rm -rf docs/docs.go docs/swagger.json docs/swagger.yaml
|
||||
@go clean -cache -testcache -modcache
|
||||
@echo "$(CHECK) $(GREEN)Project reset complete$(RESET)"
|
||||
@rm -rf $(BASE_PATH)/tw # Remove the 'tw' directory
|
||||
@echo "$(CHECK) Project reset complete"
|
||||
|
||||
clean:
|
||||
@echo "$(CLEAN) $(CYAN)Cleaning build artifacts...$(RESET)"
|
||||
@echo "$(CLEAN) Cleaning build artifacts..."
|
||||
@rm -f $(BINARY_NAME)
|
||||
@rm -f $(CSS_OUTPUT)
|
||||
@echo "$(CHECK) $(GREEN)Cleanup complete$(RESET)"
|
||||
@rm -rf $(BASE_PATH)/lib/stylegen/tw # Remove the 'tw' directory
|
||||
@echo "$(CHECK) Cleanup complete"
|
||||
|
||||
stylegen:
|
||||
@echo "$(CSS) $(CYAN)Generating CSS styles...$(RESET)"
|
||||
@echo "$(CSS) Generating CSS styles..."
|
||||
@echo "Current working directory: $$(pwd)"
|
||||
@echo "Contents of current directory:"
|
||||
@ls -la
|
||||
@echo "\nContents of lib/stylegen:"
|
||||
@ls -la lib/stylegen
|
||||
@echo "\nContents of lib/stylegen/tw:"
|
||||
@ls -la lib/stylegen/tw
|
||||
@chmod +x $(BASE_PATH)/lib/stylegen/gen.sh
|
||||
@chmod +x $(BASE_PATH)/lib/stylegen/tw/*
|
||||
@$(BASE_PATH)/lib/stylegen/gen.sh \
|
||||
-e "html" \
|
||||
-d "$(BASE_PATH)/pages/templates" \
|
||||
-o "$(BASE_PATH)/public/css"
|
||||
@echo "$(CHECK) $(GREEN)CSS generation complete$(RESET)"
|
||||
@echo "$(CHECK) CSS generation complete"
|
||||
|
||||
swaggergen: ensure-swag
|
||||
@echo "$(DOCS) $(CYAN)Generating Swagger documentation...$(RESET)"
|
||||
@echo "$(DOCS) Generating Swagger documentation..."
|
||||
@swag init
|
||||
@echo "$(CHECK) $(GREEN)Swagger docs generated$(RESET)"
|
||||
@echo "$(CHECK) Swagger docs generated"
|
||||
|
||||
# Combined generation target
|
||||
generate: stylegen swaggergen
|
||||
|
||||
build: generate
|
||||
@echo "$(BUILD) $(CYAN)Building binary...$(RESET)"
|
||||
@echo "$(BUILD) Building binary..."
|
||||
@go build -o $(BINARY_NAME)
|
||||
@echo "$(CHECK) $(GREEN)Build complete: $(BINARY_NAME)$(RESET)"
|
||||
@echo "$(CHECK) Build complete: $(BINARY_NAME)"
|
||||
|
||||
test:
|
||||
@echo "$(TEST) $(CYAN)Running tests...$(RESET)"
|
||||
@echo "$(TEST) Running tests..."
|
||||
@go test ./...
|
||||
@echo "$(CHECK) $(GREEN)Tests complete$(RESET)"
|
||||
@echo "$(CHECK) Tests complete"
|
||||
|
||||
dev: generate
|
||||
@echo "$(RUN) $(CYAN)Starting development server...$(RESET)"
|
||||
@echo "$(RUN) Starting development server..."
|
||||
@go run main.go
|
||||
|
||||
run: build
|
||||
@echo "$(RUN) $(CYAN)Running server...$(RESET)"
|
||||
@echo "$(RUN) Running server..."
|
||||
@./$(BINARY_NAME)
|
||||
|
||||
docker-dev:
|
||||
@echo "$(DOCKER) $(CYAN)Starting development container...$(RESET)"
|
||||
@echo "$(DOCKER) Starting development container..."
|
||||
@docker-compose -f docker-compose.dev.yml up --build
|
||||
|
||||
docker-build: generate
|
||||
@echo "$(DOCKER) $(CYAN)Building production Docker image...$(RESET)"
|
||||
@echo "$(DOCKER) Building production Docker image..."
|
||||
@docker build -t $(DOCKER_IMAGE) .
|
||||
@echo "$(CHECK) $(GREEN)Docker image build complete$(RESET)"
|
||||
@echo "$(CHECK) Docker image build complete"
|
||||
|
||||
docker-run: docker-build
|
||||
@echo "$(DOCKER) $(CYAN)Running production container...$(RESET)"
|
||||
@echo "$(DOCKER) Running production container..."
|
||||
@docker-compose up
|
||||
|
||||
deps:
|
||||
@echo "$(BUILD) $(CYAN)Installing dependencies...$(RESET)"
|
||||
@echo "$(BUILD) Installing dependencies..."
|
||||
@go mod download
|
||||
@go install github.com/swaggo/swag/cmd/swag@latest
|
||||
@echo "$(CHECK) $(GREEN)Dependencies installed$(RESET)"
|
||||
@echo "$(CHECK) Dependencies installed"
|
||||
|
||||
fmt:
|
||||
@echo "$(BUILD) $(CYAN)Formatting code...$(RESET)"
|
||||
@echo "$(BUILD) Formatting code..."
|
||||
@go fmt ./...
|
||||
@echo "$(CHECK) $(GREEN)Code formatting complete$(RESET)"
|
||||
@echo "$(CHECK) Code formatting complete"
|
||||
|
||||
# Full production build
|
||||
prod: clean generate build
|
||||
@echo "$(CHECK) $(GREEN)Production build complete$(RESET)"
|
||||
@echo "$(CHECK) Production build complete"
|
||||
|
||||
.DEFAULT_GOAL := help
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!/bin/bash
|
||||
# Define the version of the binary to download
|
||||
VERSION="v1.7.27"
|
||||
|
||||
# Parse command-line arguments
|
||||
while [[ $# -gt 0 ]]; do
|
||||
|
@ -62,23 +63,35 @@ esac
|
|||
echo "Detected OS: $OS"
|
||||
echo "Detected Architecture: $ARCH"
|
||||
|
||||
# Use tw directory in script location
|
||||
BINARY="${SCRIPT_DIR}/tw/${OS}-${ARCH}"
|
||||
if [ "$OS" = "windows" ]; then
|
||||
BINARY="${BINARY}.exe"
|
||||
fi
|
||||
# Function to construct the binary download URL based on version, OS, and architecture
|
||||
get_binary_url() {
|
||||
echo "https://github.com/dobicinaitis/tailwind-cli-extra/releases/download/$VERSION/tailwindcss-extra-$OS-$ARCH"
|
||||
}
|
||||
|
||||
echo "Looking for binary at: $BINARY"
|
||||
# Create the 'tw' directory for storing the downloaded binary
|
||||
TW_DIR="${SCRIPT_DIR}/tw"
|
||||
mkdir -p "$TW_DIR"
|
||||
|
||||
# Check if binary exists
|
||||
# Set the binary path
|
||||
BINARY="${TW_DIR}/tailwindcss-extra-${OS}-${ARCH}"
|
||||
|
||||
# Check if the binary is already downloaded, otherwise download it
|
||||
if [ ! -f "$BINARY" ]; then
|
||||
echo "Binary not found: $BINARY"
|
||||
echo "Contents of ${SCRIPT_DIR}/tw/:"
|
||||
ls -la "${SCRIPT_DIR}/tw/"
|
||||
echo "Binary not found, downloading version $VERSION..."
|
||||
|
||||
DOWNLOAD_URL=$(get_binary_url)
|
||||
|
||||
if [ -z "$DOWNLOAD_URL" ]; then
|
||||
echo "No suitable release found for this OS and architecture."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Download the binary
|
||||
curl -L "$DOWNLOAD_URL" -o "$BINARY"
|
||||
echo "Downloaded binary to: $BINARY"
|
||||
fi
|
||||
|
||||
# Make binary executable
|
||||
# Make the binary executable
|
||||
chmod +x "$BINARY"
|
||||
|
||||
echo "Using binary: $BINARY"
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
2
public/css/styles.css
vendored
2
public/css/styles.css
vendored
File diff suppressed because one or more lines are too long
Loading…
Add table
Reference in a new issue