-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile.docs
More file actions
135 lines (117 loc) · 4.87 KB
/
Makefile.docs
File metadata and controls
135 lines (117 loc) · 4.87 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
# FastMarkDocs Documentation Makefile
# Provides simple commands for building and serving documentation
# Directory configuration
DOCS_SRC_DIR = src/docs
DOCS_OUTPUT_DIR = docs
.PHONY: docs-help docs-setup docs-build docs-serve docs-clean docs-validate
# Default target
docs-help:
@echo "FastMarkDocs Documentation Commands"
@echo ""
@echo "Available targets:"
@echo " docs-setup Setup documentation environment"
@echo " docs-build Build documentation"
@echo " docs-serve Build and serve documentation locally"
@echo " docs-clean Clean build artifacts"
@echo " docs-validate Validate built documentation"
@echo " docs-help Show this help"
@echo ""
@echo "Environment variables:"
@echo " DOCS_PORT Port for local server (default: 4000)"
@echo " DOCS_HOST Host for local server (default: 127.0.0.1)"
@echo ""
@echo "Directory structure:"
@echo " Source: $(DOCS_SRC_DIR)/"
@echo " Output: $(DOCS_OUTPUT_DIR)/"
@echo ""
@echo "Examples:"
@echo " make docs-setup"
@echo " make docs-serve"
@echo " make docs-serve DOCS_PORT=3000"
# Setup documentation environment
docs-setup:
@echo "Setting up documentation environment..."
@./build-docs.sh setup
# Build documentation
docs-build:
@echo "Building documentation..."
@echo "Source: $(DOCS_SRC_DIR)/ -> Output: $(DOCS_OUTPUT_DIR)/"
@cd $(DOCS_SRC_DIR) && bundle exec jekyll build --destination ../../$(DOCS_OUTPUT_DIR)
# Serve documentation locally
docs-serve:
@echo "Starting documentation server..."
@echo "Source: $(DOCS_SRC_DIR)/ -> Output: $(DOCS_OUTPUT_DIR)/"
@cd $(DOCS_SRC_DIR) && bundle exec jekyll serve --destination ../../$(DOCS_OUTPUT_DIR) --port $${DOCS_PORT:-4001} --host $${DOCS_HOST:-0.0.0.0}
# Clean build artifacts
docs-clean:
@echo "Cleaning documentation build artifacts..."
@rm -rf $(DOCS_OUTPUT_DIR)
@rm -rf $(DOCS_SRC_DIR)/_site
@rm -rf $(DOCS_SRC_DIR)/.sass-cache
@rm -f $(DOCS_SRC_DIR)/.jekyll-metadata
@rm -rf $(DOCS_SRC_DIR)/.jekyll-cache
@echo "Cleaned: $(DOCS_OUTPUT_DIR)/, _site/, .sass-cache/, .jekyll-metadata, .jekyll-cache/"
# Validate documentation build
docs-validate:
@echo "Validating documentation build..."
@cd $(DOCS_SRC_DIR) && bundle exec jekyll doctor
@if [ -d "$(DOCS_OUTPUT_DIR)" ]; then \
echo "✓ Output directory exists: $(DOCS_OUTPUT_DIR)/"; \
echo "✓ Generated files: $$(find $(DOCS_OUTPUT_DIR) -name '*.html' | wc -l) HTML files"; \
else \
echo "✗ Output directory not found. Run 'make docs-build' first."; \
exit 1; \
fi
# Quick development server (alias for docs-serve)
docs-dev: docs-serve
# Full rebuild (clean + build + serve)
docs-rebuild: docs-clean docs-serve
# Check if Ruby and Jekyll are installed
docs-check:
@echo "Checking documentation dependencies..."
@which ruby > /dev/null || (echo "Ruby not found. Please install Ruby first." && exit 1)
@which bundle > /dev/null || (echo "Bundler not found. Installing..." && gem install bundler)
@echo "Dependencies check completed."
# Install only Jekyll dependencies (without building)
docs-install:
@echo "Installing Jekyll dependencies..."
@cd $(DOCS_SRC_DIR) && bundle install --path /tmp/fastmarkdocs-bundle
# Update Jekyll dependencies
docs-update:
@echo "Updating Jekyll dependencies..."
@cd $(DOCS_SRC_DIR) && bundle update
# Show Jekyll version info
docs-info:
@echo "Jekyll Environment Information:"
@echo "Ruby version: $$(ruby --version)"
@echo "Bundler version: $$(bundle --version)"
@cd $(DOCS_SRC_DIR) && echo "Jekyll version: $$(bundle exec jekyll --version)"
@cd $(DOCS_SRC_DIR) && echo "Theme: $$(bundle exec jekyll doctor | grep -i theme || echo 'minima')"
@echo "Source directory: $(DOCS_SRC_DIR)/"
@echo "Output directory: $(DOCS_OUTPUT_DIR)/"
# Production build (optimized)
docs-production:
@echo "Building documentation for production..."
@cd $(DOCS_SRC_DIR) && JEKYLL_ENV=production bundle exec jekyll build --destination ../../$(DOCS_OUTPUT_DIR) --verbose
# Lint documentation (check for broken links, etc.)
docs-lint:
@echo "Linting documentation..."
@cd $(DOCS_SRC_DIR) && bundle exec jekyll doctor
@echo "Documentation lint completed."
# Watch for changes and rebuild automatically
docs-watch:
@echo "Watching for documentation changes..."
@cd $(DOCS_SRC_DIR) && bundle exec jekyll build --destination ../../$(DOCS_OUTPUT_DIR) --watch --incremental
# Generate site statistics
docs-stats:
@echo "Documentation Statistics:"
@echo "Source directory: $(DOCS_SRC_DIR)/"
@echo "Output directory: $(DOCS_OUTPUT_DIR)/"
@echo "Markdown files: $$(find $(DOCS_SRC_DIR) -name '*.md' | wc -l)"
@echo "Total lines: $$(find $(DOCS_SRC_DIR) -name '*.md' -exec wc -l {} + | tail -1 | awk '{print $$1}')"
@if [ -d "$(DOCS_OUTPUT_DIR)" ]; then \
echo "Generated HTML files: $$(find $(DOCS_OUTPUT_DIR) -name '*.html' | wc -l)"; \
echo "Build size: $$(du -sh $(DOCS_OUTPUT_DIR) | cut -f1)"; \
else \
echo "No build found. Run 'make docs-build' first."; \
fi