# JQuote Plugin Makefile # Author: Jan # License: MIT .PHONY: test test-verbose lint format check clean install help # Default target .DEFAULT_GOAL := help # Colors for output BOLD := \033[1m RED := \033[31m GREEN := \033[32m YELLOW := \033[33m BLUE := \033[34m RESET := \033[0m # Project directories LUA_DIR := lua TEST_DIR := tests PLUGIN_DIR := plugin # Lua interpreter LUA := lua ## Run all tests test: @echo "$(BLUE)$(BOLD)Running JQuote Plugin Tests...$(RESET)" @cd $(PWD) && $(LUA) tests/test_runner.lua ## Run tests with verbose output test-verbose: test @echo "$(GREEN)Test execution completed$(RESET)" ## Check code quality (basic syntax check) check: @echo "$(BLUE)$(BOLD)Checking Lua syntax...$(RESET)" @for file in $$(find $(LUA_DIR) -name "*.lua"); do \ echo "Checking $$file..."; \ $(LUA) -e "loadfile('$$file')"; \ if [ $$? -ne 0 ]; then \ echo "$(RED)Syntax error in $$file$(RESET)"; \ exit 1; \ fi; \ done @echo "$(GREEN)All Lua files have valid syntax$(RESET)" ## Format code (placeholder - would use stylua if available) format: @echo "$(YELLOW)Code formatting would require stylua or similar tool$(RESET)" @echo "$(YELLOW)Install with: cargo install stylua$(RESET)" ## Run linter (placeholder - would use luacheck if available) lint: @echo "$(YELLOW)Linting would require luacheck$(RESET)" @echo "$(YELLOW)Install with: luarocks install luacheck$(RESET)" ## Clean temporary files clean: @echo "$(BLUE)Cleaning temporary files...$(RESET)" @find . -name "*.tmp" -delete 2>/dev/null || true @find . -name "*.log" -delete 2>/dev/null || true @echo "$(GREEN)Cleanup completed$(RESET)" ## Install plugin (symlink to Neovim config) install: @echo "$(BLUE)$(BOLD)Installing JQuote Plugin...$(RESET)" @if [ -z "$$XDG_CONFIG_HOME" ]; then \ NVIM_CONFIG="$$HOME/.config/nvim"; \ else \ NVIM_CONFIG="$$XDG_CONFIG_HOME/nvim"; \ fi; \ if [ ! -d "$$NVIM_CONFIG" ]; then \ echo "$(RED)Neovim config directory not found: $$NVIM_CONFIG$(RESET)"; \ exit 1; \ fi; \ PLUGIN_TARGET="$$NVIM_CONFIG/lua/jquote"; \ if [ -L "$$PLUGIN_TARGET" ] || [ -d "$$PLUGIN_TARGET" ]; then \ echo "$(YELLOW)Plugin already installed, removing old version...$(RESET)"; \ rm -rf "$$PLUGIN_TARGET"; \ fi; \ ln -s "$(PWD)/$(LUA_DIR)/jquote" "$$PLUGIN_TARGET"; \ echo "$(GREEN)Plugin installed successfully to $$PLUGIN_TARGET$(RESET)" ## Run development checks (syntax + tests) dev-check: check test @echo "$(GREEN)$(BOLD)All development checks passed!$(RESET)" ## Show help help: @echo "$(BOLD)JQuote Plugin Development Commands$(RESET)" @echo "" @echo "$(BOLD)Available targets:$(RESET)" @awk 'BEGIN {FS = ":.*##"} /^[a-zA-Z_-]+:.*##/ { printf " $(BLUE)%-15s$(RESET) %s\n", $$1, $$2 }' $(MAKEFILE_LIST) @echo "" @echo "$(BOLD)Usage Examples:$(RESET)" @echo " make test # Run all tests" @echo " make check # Check syntax" @echo " make dev-check # Run all development checks" @echo " make install # Install plugin to Neovim" @echo "" ## Quick development workflow quick: clean check test @echo "$(GREEN)$(BOLD)Quick development check completed!$(RESET)"