-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
81 lines (62 loc) · 3.06 KB
/
Makefile
File metadata and controls
81 lines (62 loc) · 3.06 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
# ────────────────────────────────────────────────────────────
# Owlstack WordPress Plugin — Makefile
# ────────────────────────────────────────────────────────────
PLUGIN_SLUG := owlstack
VERSION ?= $(shell grep -i 'Version:' owlstack.php | head -1 | sed 's/.*Version:[[:space:]]*//' | tr -d '[:space:]')
DIST_DIR := dist
BUILD_DIR := $(DIST_DIR)/$(PLUGIN_SLUG)
ZIP_FILE := $(DIST_DIR)/$(PLUGIN_SLUG)-$(VERSION).zip
.DEFAULT_GOAL := help
# ── Development ──────────────────────────────────────────────
.PHONY: install
install: ## Install all Composer dependencies (dev + prod)
composer install --prefer-dist
.PHONY: lint
lint: ## Run PHPCS (WordPress coding standards)
php -d xdebug.mode=off vendor/bin/phpcs --standard=WordPress src/ owlstack.php
.PHONY: lint-fix
lint-fix: ## Auto-fix PHPCS violations where possible
php -d xdebug.mode=off vendor/bin/phpcbf --standard=WordPress src/ owlstack.php
.PHONY: test
test: ## Run PHPUnit tests
vendor/bin/phpunit
# ── Build / Release ─────────────────────────────────────────
.PHONY: build
build: clean ## Build distribution zip for WordPress marketplace
@echo "==> Building $(PLUGIN_SLUG) v$(VERSION)"
@# Install production-only dependencies.
composer install --no-dev --prefer-dist --optimize-autoloader --quiet
@# Create build directory and sync files.
@mkdir -p $(BUILD_DIR)
rsync -rc --exclude-from=".distignore" ./ $(BUILD_DIR)/
@# Remove dev vendor packages (safety net).
rm -rf $(BUILD_DIR)/vendor/phpunit \
$(BUILD_DIR)/vendor/phpcsstandards \
$(BUILD_DIR)/vendor/squizlabs \
$(BUILD_DIR)/vendor/wp-coding-standards \
$(BUILD_DIR)/vendor/dealerdirect \
$(BUILD_DIR)/vendor/staabm \
$(BUILD_DIR)/vendor/phar-io \
$(BUILD_DIR)/vendor/sebastian \
$(BUILD_DIR)/vendor/theseer \
$(BUILD_DIR)/vendor/nikic \
$(BUILD_DIR)/vendor/myclabs \
$(BUILD_DIR)/vendor/bin
@# Create the zip.
@echo "==> Creating zip…"
cd $(DIST_DIR) && zip -rq ../$(ZIP_FILE) $(PLUGIN_SLUG)/
@# Clean up build directory.
rm -rf $(BUILD_DIR)
@# Restore dev dependencies.
@echo "==> Restoring dev dependencies…"
composer install --quiet
@echo "==> Done! $(ZIP_FILE)"
@echo " Size: $$(du -h $(ZIP_FILE) | cut -f1)"
.PHONY: clean
clean: ## Remove previous build artifacts
rm -rf $(DIST_DIR)
# ── Help ─────────────────────────────────────────────────────
.PHONY: help
help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-12s\033[0m %s\n", $$1, $$2}'