-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Makefile
50 lines (41 loc) · 1.48 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
SHELL := /bin/bash
IMAGEMAGICK_DOCKER_IMAGE = orbitale-imphp
PHP_BIN = php
# Helper vars
_TITLE := "\033[32m[%s]\033[0m %s\n"
_ERROR := "\033[31m[%s]\033[0m %s\n"
.DEFAULT_GOAL := help
help: ## Show this help.
@printf "\n Available commands:\n\n"
@grep -E '(^[a-zA-Z_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-25s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m## */[33m/'
.PHONY: help
install: vendor imagemagick-docker ## Install composer dependencies and Docker image for testing
.PHONY: install
start: ## Start Docker image for testing
@docker start $(IMAGEMAGICK_DOCKER_IMAGE)
.PHONY: start
stop: ## Stop testing Docker image
@docker stop $(IMAGEMAGICK_DOCKER_IMAGE)
.PHONY: stop
test: start ## Start Docker image for testing
export IMAGEMAGICK_PATH="docker exec $(IMAGEMAGICK_DOCKER_IMAGE) `pwd`/docker_entrypoint.sh magick" && \
$(PHP_BIN) vendor/bin/phpunit
$(MAKE) stop
.PHONY: test
vendor:
@printf $(_TITLE) "Install" "Installing Composer dependencies"
@composer update
.PHONY: vendor
imagemagick-docker:
@printf $(_TITLE) "Install" "Removing existing Docker image"
@docker rm --force --volumes $(IMAGEMAGICK_DOCKER_IMAGE)
@printf $(_TITLE) "Install" "Creating ImageMagick Docker image for development"
@docker create \
--name=$(IMAGEMAGICK_DOCKER_IMAGE) \
--volume `pwd`:`pwd` \
--workdir=`pwd` \
--entrypoint="`pwd`/docker_entrypoint.sh" \
dpokidov/imagemagick:latest \
sleep 9999999 \
>/dev/null
.PHONY: imagemagick-docker