forked from monsieurbiz/SyliusSettingsPlugin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
138 lines (101 loc) · 3.81 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
.DEFAULT_GOAL := help
SHELL=/bin/bash
SYMFONY=cd tests/Application && symfony
COMPOSER=symfony composer
CONSOLE=${SYMFONY} console
PHPSTAN=${SYMFONY} php vendor/bin/phpstan
export COMPOSE_PROJECT_NAME=settings
DOCTRINE_NAMESPACE=MonsieurBiz\SyliusSettingsPlugin\Migrations
COMPOSE=docker-compose
YARN=cd tests/Application && yarn
###
### DEVELOPMENT
### ¯¯¯¯¯¯¯¯¯¯¯
install: platform sylius ## Install the plugin
.PHONY: install
up: docker.up server.start ## Up the project (start docker, start symfony server)
stop: server.stop docker.stop ## Stop the project (stop docker, stop symfony server)
down: server.stop docker.down ## Down the project (removes docker containers, stop symfony server)
reset: docker.down ## Stop docker and remove dependencies
rm -rf tests/Application/{node_modules} tests/Application/yarn.lock
rm -rf vendor composer.lock
.PHONY: reset
dependencies: vendor node_modules ## Setup the dependencies
.PHONY: dependencies
.php-version: .php-version.dist
cp .php-version.dist .php-version
(cd tests/Application && ln -sf ../../.php-version)
vendor: composer.lock ## Install the PHP dependencies using composer
${COMPOSER} install --prefer-source
composer.lock: composer.json
${COMPOSER} update --prefer-source
yarn.install: tests/Application/yarn.lock
tests/Application/yarn.lock:
${YARN} install
${YARN} build
node_modules: tests/Application/node_modules ## Install the Node dependencies using yarn
tests/Application/node_modules: yarn.install
###
### TESTS
### ¯¯¯¯¯
test.all: test.phpstan test.phpcs test.phpmd test.yaml test.schema test.twig
test.phpstan:
${COMPOSER} run -- phpstan
test.phpcs: ## Run PHP CS Fixer in dry-run
${COMPOSER} run -- phpcs --dry-run -v
test.phpcs.fix: ## Run PHP CS Fixer and fix issues if possible
${COMPOSER} run -- phpcs -v
test.phpmd: ## Run PHP Mass Detector
${COMPOSER} run -- phpmd
test.container: ## Lint the symfony container
${CONSOLE} lint:container
test.yaml: ## Lint the symfony Yaml files
${CONSOLE} lint:yaml ../../recipes ../../src/Resources/config
test.schema: ## Validate MySQL Schema
${CONSOLE} doctrine:schema:validate
test.twig: ## Validate Twig templates
${CONSOLE} lint:twig --no-debug templates/ ../../src/Resources/views/
###
### SYLIUS
### ¯¯¯¯¯¯
sylius: dependencies sylius.database sylius.fixtures ## Install Sylius
.PHONY: sylius
sylius.database: ## Setup the database
${CONSOLE} doctrine:database:drop --if-exists --force
${CONSOLE} doctrine:database:create --if-not-exists
${CONSOLE} doctrine:migration:migrate -n
sylius.fixtures: ## Run the fixtures
${CONSOLE} sylius:fixtures:load -n default
doctrine.diff: ## Make doctrine diff
${CONSOLE} doctrine:migration:diff --namespace="${DOCTRINE_NAMESPACE}"
###
### PLATFORM
### ¯¯¯¯¯¯¯¯
platform: .php-version up ## Setup the platform tools
.PHONY: platform
docker.pull: ## Pull the docker images
cd tests/Application && ${COMPOSE} pull
docker.up: ## Start the docker containers
cd tests/Application && ${COMPOSE} up -d
.PHONY: docker.up
docker.stop: ## Stop the docker containers
cd tests/Application && ${COMPOSE} stop
.PHONY: docker.stop
docker.down: ## Stop and remove the docker containers
cd tests/Application && ${COMPOSE} down
.PHONY: docker.down
server.start: ## Run the local webserver using Symfony
${SYMFONY} local:proxy:domain:attach settings
${SYMFONY} local:server:start -d
server.stop: ## Stop the local webserver
${SYMFONY} local:server:stop
###
### HELP
### ¯¯¯¯
help: SHELL=/bin/bash
help: ## Dislay this help
@IFS=$$'\n'; for line in `grep -h -E '^[a-zA-Z_#-]+:?.*?##.*$$' $(MAKEFILE_LIST)`; do if [ "$${line:0:2}" = "##" ]; then \
echo $$line | awk 'BEGIN {FS = "## "}; {printf "\033[33m %s\033[0m\n", $$2}'; else \
echo $$line | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m%s\n", $$1, $$2}'; fi; \
done; unset IFS;
.PHONY: help