-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
147 lines (123 loc) · 4.48 KB
/
Makefile
File metadata and controls
147 lines (123 loc) · 4.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
BASEDIR=$(CURDIR)
DOTBOT=$(BASEDIR)/dotbot/bin/dotbot
INSTALL_STATE_FILE=$(BASEDIR)/.install_state
default:
@echo "Available installation options:"
@echo " make full - Full desktop environment installation"
@echo " make minimal - Minimal server installation"
@echo " make macos - macOS environment installation"
@echo ""
@echo "Other commands:"
@echo " make update - Update submodules"
@if [ -f $(INSTALL_STATE_FILE) ]; then \
echo "Current installation type: $$(cat $(INSTALL_STATE_FILE))"; \
else \
echo "No previous installation detected"; \
fi
update:
cd $(BASEDIR)
git submodule update --init --recursive
check-state:
@if [ -f $(INSTALL_STATE_FILE) ]; then \
if [ "$$(cat $(INSTALL_STATE_FILE))" != "$(TYPE)" ]; then \
echo "Error: Attempting to install $(TYPE) over existing $$(cat $(INSTALL_STATE_FILE)) installation."; \
echo "Please backup and remove ~/.* files before changing installation type."; \
exit 1; \
fi \
fi
minimal: TYPE=minimal
minimal: check-state update
@echo "minimal" > $(INSTALL_STATE_FILE)
SHELL=/bin/bash $(DOTBOT) -d $(BASEDIR) -c minimal.yaml
full: TYPE=full
full: check-state update
@echo "full" > $(INSTALL_STATE_FILE)
sudo SHELL=/bin/bash $(DOTBOT) -d $(BASEDIR) -c system.yaml
SHELL=/bin/bash $(DOTBOT) -d $(BASEDIR) -c local.yaml
macos: TYPE=macos
macos: check-state update
@echo "macos" > $(INSTALL_STATE_FILE)
SHELL=/bin/bash $(DOTBOT) -d $(BASEDIR) -c macos.yaml
private: update
SHELL=/bin/bash $(DOTBOT) -d $(BASEDIR) -c private.yaml
# Colors for beautiful output
PURPLE := \033[1;35m
PINK := \033[1;95m
CYAN := \033[1;36m
GREEN := \033[1;32m
YELLOW := \033[1;33m
CORAL := \033[1;91m
GRAY := \033[0;90m
RESET := \033[0m
BOLD := \033[1m
# Unicode symbols
CHECK := ✓
ARROW := →
BULLET := •
WARNING := !
ERROR := ×
# Linting and formatting
lint: lint-header lint-shell lint-yaml lint-lua lint-json lint-markdown lint-footer
lint-header:
@echo ""
@echo "$(PURPLE)▶ $(CYAN)Running Linters$(RESET)"
@echo ""
lint-shell:
@echo "$(CYAN)$(ARROW)$(RESET) $(BOLD)Shell Scripts$(RESET)"
@./bin/shellint --check sh/ bin/
@echo ""
lint-yaml:
@echo "$(PINK)$(ARROW)$(RESET) $(BOLD)YAML Files$(RESET)"
@echo " $(GRAY)$(BULLET) Validating with prettier...$(RESET)"
-@git ls-files '*.yml' '*.yaml' | xargs npx prettier --check 2>&1 | sed 's/^/ │ /' || true
@echo " $(GREEN)$(CHECK) YAML linting complete$(RESET)"
@echo ""
lint-lua:
@echo "$(PURPLE)$(ARROW)$(RESET) $(BOLD)Lua Files$(RESET)"
@echo " $(GRAY)$(BULLET) Running selene...$(RESET)"
-@cd nvim && selene lua 2>&1 | sed 's/^/ │ /' || true
@echo " $(GREEN)$(CHECK) Lua linting complete$(RESET)"
@echo ""
lint-json:
@echo "$(CORAL)$(ARROW)$(RESET) $(BOLD)JSON Files$(RESET)"
@echo " $(GRAY)$(BULLET) Validating JSON...$(RESET)"
-@git ls-files '*.json' | xargs -I {} sh -c \
'jq . {} > /dev/null 2>&1 || echo " │ $(YELLOW)$(WARNING)$(RESET) Invalid JSON: {}"' || true
@echo " $(GREEN)$(CHECK) JSON validation complete$(RESET)"
@echo ""
lint-markdown:
@echo "$(YELLOW)$(ARROW)$(RESET) $(BOLD)Markdown Files$(RESET)"
@echo " $(GRAY)$(BULLET) Running markdownlint...$(RESET)"
-@git ls-files '*.md' | xargs -n1 markdownlint 2>&1 | \
sed 's/^/ │ /' || true
@echo " $(GREEN)$(CHECK) Markdown linting complete$(RESET)"
@echo ""
lint-footer:
@echo ""
@echo "$(GREEN)$(CHECK)$(RESET) $(BOLD)All linting checks completed!$(RESET)"
@echo ""
format: format-header format-shell format-prettier format-lua format-footer
format-header:
@echo ""
@echo "$(PURPLE)▶ $(PINK)Running Formatters$(RESET)"
@echo ""
format-shell:
@echo "$(CYAN)$(ARROW)$(RESET) $(BOLD)Shell Scripts$(RESET)"
@./bin/shellint --format --fix sh/ bin/
@echo ""
format-prettier:
@echo "$(PINK)$(ARROW)$(RESET) $(BOLD)YAML, JSON & Markdown Files$(RESET)"
@echo " $(GRAY)$(BULLET) Formatting with prettier...$(RESET)"
-@git ls-files '*.yml' '*.yaml' '*.json' '*.md' | xargs npx prettier --write 2>&1 | \
grep -v "unchanged" | sed 's/^/ │ /' || true
@echo ""
format-lua:
@echo "$(PURPLE)$(ARROW)$(RESET) $(BOLD)Lua Files$(RESET)"
@echo " $(GRAY)$(BULLET) Formatting with stylua...$(RESET)"
-@cd nvim && stylua lua 2>&1 | sed 's/^/ │ /' || true
@echo ""
format-footer:
@echo ""
@echo "$(GREEN)$(CHECK)$(RESET) $(BOLD)All formatting completed!$(RESET)"
@echo ""
.PHONY: default update check-state minimal full macos lint lint-header lint-shell lint-yaml lint-lua lint-json lint-markdown lint-footer format format-header format-shell format-yaml format-lua format-json format-markdown format-footer