-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
59 lines (49 loc) · 2.36 KB
/
Makefile
File metadata and controls
59 lines (49 loc) · 2.36 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
.PHONY: install test test-all setup-integrations clean help
# Default WordPress develop location
WORDPRESS_DEVELOP_DIR ?= $(HOME)/workspace/wordpress-develop
DATABASE_MODULE_DIR ?= $(shell dirname $(CURDIR))/database-module
TANGIBLE_FIELDS_DIR ?= $(shell dirname $(CURDIR))/fields
help:
@echo "Available targets:"
@echo " make install - Install composer dependencies"
@echo " make test - Run tests (skips integration tests if deps missing)"
@echo " make test-all - Run all tests (requires setup-integrations first)"
@echo " make setup-integrations - Clone optional integration dependencies"
@echo " make setup-wp - Clone WordPress develop for testing"
@echo " make clean - Remove cloned dependencies"
install:
composer install
test:
WORDPRESS_DEVELOP_DIR=$(WORDPRESS_DEVELOP_DIR) ./vendor/bin/phpunit
test-all: setup-integrations
WORDPRESS_DEVELOP_DIR=$(WORDPRESS_DEVELOP_DIR) \
DATABASE_MODULE_DIR=$(DATABASE_MODULE_DIR) \
TANGIBLE_FIELDS_DIR=$(TANGIBLE_FIELDS_DIR) \
./vendor/bin/phpunit
setup-integrations: setup-database-module setup-tangible-fields
setup-database-module:
@if [ ! -d "$(DATABASE_MODULE_DIR)" ]; then \
echo "Cloning database-module to $(DATABASE_MODULE_DIR)..."; \
git clone https://github.com/tangibleinc/database-module.git $(DATABASE_MODULE_DIR); \
else \
echo "database-module already exists at $(DATABASE_MODULE_DIR)"; \
fi
setup-tangible-fields:
@if [ ! -d "$(TANGIBLE_FIELDS_DIR)" ]; then \
echo "Cloning tangible-fields to $(TANGIBLE_FIELDS_DIR)..."; \
git clone https://github.com/tangibleinc/fields.git $(TANGIBLE_FIELDS_DIR); \
else \
echo "tangible-fields already exists at $(TANGIBLE_FIELDS_DIR)"; \
fi
setup-wp:
@if [ ! -d "$(WORDPRESS_DEVELOP_DIR)" ]; then \
echo "Cloning wordpress-develop to $(WORDPRESS_DEVELOP_DIR)..."; \
git clone --depth=1 https://github.com/WordPress/wordpress-develop.git $(WORDPRESS_DEVELOP_DIR); \
cp $(WORDPRESS_DEVELOP_DIR)/wp-tests-config-sample.php $(WORDPRESS_DEVELOP_DIR)/wp-tests-config.php; \
echo "NOTE: Edit $(WORDPRESS_DEVELOP_DIR)/wp-tests-config.php with your database credentials"; \
else \
echo "wordpress-develop already exists at $(WORDPRESS_DEVELOP_DIR)"; \
fi
clean:
@echo "This will remove cloned integration dependencies. Are you sure? [y/N]" && read ans && [ $${ans:-N} = y ]
rm -rf $(DATABASE_MODULE_DIR)