-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
162 lines (131 loc) · 4.92 KB
/
Makefile
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# Makefile for AIF-C01 course (Student-focused with advanced features)
# Variables
ORG_FILES := $(wildcard doc/README/includes/*.org)
MERMAID_ORG_FILES := $(wildcard doc/README/includes/*.org)
EXPORT_DIR := doc/export
# Default target
.DEFAULT_GOAL := help
# Phony targets
.PHONY: all help setup run test aws-practice localstack-up localstack-down \
switch-profile-lcl switch-profile-dev study-resources clean lint \
tangle generate-diagrams export-org install-emacs-packages deps \
aws-audit aws-cleanup
# Auto-generated help target
help:
@echo "Available commands for AIF-C01 course:"
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
all: setup study-resources ## Set up the environment and generate study resources
setup: ## Set up the project environment
@echo "Setting up the project environment..."
@lein deps
@poetry install
@make install-emacs-packages
@echo "Environment setup complete. You're ready to start learning!"
run: ## Run the main application
@echo "Running the main application..."
@lein run
test: ## Run test suite
@echo "Running tests..."
@lein test
lint: ## Run linters
@echo "Running linters..."
@lein eastwood
@lein cljfmt check
@flake8 scripts
@black --check scripts
lint-fix: ## Fix linting issues
@echo "Fixing linting issues..."
@lein cljfmt fix
@black scripts
format: ## Format Clojure and Python files
aws-practice: ## Practice with AWS resources (audit and optionally clean up)
@echo "Starting AWS resource practice session..."
@echo "This will list your AWS resources related to the course."
@echo "To clean up resources, run 'make aws-practice-cleanup' instead."
@python scripts/aws_resource_manager.py
aws-practice-cleanup: ## Clean up AWS resources used in practice
@echo "Cleaning up AWS resources..."
@echo "This will attempt to remove resources created during practice."
@echo "S3 buckets will not be deleted for safety reasons."
@python scripts/aws_resource_manager.py --clean
localstack-up: ## Start LocalStack for local AWS development
@echo "Starting LocalStack..."
@docker-compose up -d localstack
localstack-down: ## Stop LocalStack
@echo "Stopping LocalStack..."
@docker-compose down
switch-profile-lcl: ## Switch to LocalStack profile
@echo "Switching to LocalStack profile..."
@source scripts/switch_profile.sh lcl
switch-profile-dev: ## Switch to AWS dev profile
@echo "Switching to AWS dev profile..."
@source scripts/switch_profile.sh dev
study-resources: ## Generate study resources
@echo "Generating study resources..."
@emacs --batch --eval "(progn \
(require 'org) \
(find-file \"doc/README/index.org\") \
(org-babel-execute-buffer) \
(org-odt-export-to-odt))"
@echo "Study resources generated. Check doc/README/index.odt"
tangle: ## Tangle code blocks from org files
@echo "Tangling code blocks..."
@for file in $(ORG_FILES); do \
emacs --batch --eval "(progn \
(require 'org) \
(org-babel-tangle-file \"$$file\"))"; \
done
@echo "Tangling complete."
generate-diagrams: ## Generate diagrams from org files
@echo "Generating diagrams..."
@for file in $(MERMAID_ORG_FILES); do \
emacs --batch --eval "(progn \
(require 'org) \
(find-file \"$$file\") \
(org-babel-execute-buffer) \
(save-buffer) \
(kill-buffer))"; \
done
@echo "Diagram generation complete."
export-org: $(EXPORT_DIR) ## Export org files to HTML
@echo "Exporting org files to HTML..."
@for file in $(ORG_FILES); do \
basename=$$(basename $$file .org); \
emacs --batch --eval "(progn \
(require 'ox-html) \
(find-file \"$$file\") \
(org-html-export-to-html nil nil nil t) \
(rename-file \"$$basename.html\" \"$(EXPORT_DIR)/$$basename.html\" t))"; \
done
@echo "Org export complete. HTML files are in $(EXPORT_DIR) directory."
$(EXPORT_DIR):
mkdir -p $(EXPORT_DIR)
clean: ## Clean up generated files
@echo "Cleaning up generated files..."
@rm -f doc/README/index.odt
@rm -f *.png
@rm -f $(EXPORT_DIR)/*.html
@echo "Cleanup complete."
install-emacs-packages: ## Install required Emacs packages
@echo "Installing Emacs packages..."
@emacs --batch --eval "(progn \
(require 'package) \
(add-to-list 'package-archives '(\"melpa\" . \"https://melpa.org/packages/\") t) \
(package-initialize) \
(package-refresh-contents) \
(package-install 'org) \
(package-install 'htmlize))"
deps: ## Update project dependencies
@echo "Updating project dependencies..."
@lein deps
@poetry update
aws-audit: ## Audit AWS resources (for advanced users)
@echo "Auditing AWS resources..."
@python scripts/aws_resource_manager.py audit
aws-cleanup: ## Clean up AWS resources (for advanced users)
@echo "Cleaning up AWS resources..."
@python scripts/aws_resource_manager.py cleanup
aws-rekognition: ## Count people
cat resources/rekognition-example.json | jq '.Labels[] | select(.Name == "Person") | .Instances | length'
aws-polly: ## Create a story from
python scripts/aws_polly_transcribe.py