.ONESHELL: # Applies to every targets in the file!

# PHP=docker exec -it -w "$(CURDIR)" php82 php

# CMS TOOLS
# generateRanking:
# 	# $(PHP) cli.php ranking generateAll
# 	cd src
# 	php cli.php ranking generateAll

updateJSAssets:
	npm install
	npm run copy-assets

updateRanking:
	$(cd src)
	composer updateRanking

# CMS Testing tools
test:
	$(cd src)
	composer test

# Specific sources testing
test-model-emulator:
	$(cd src)
	composer test-model-emulator

test-model-emulator-paradise:
	$(cd src)
	composer test-model-emulator-paradise

test-model-stream:
	$(cd src)
	composer test-model-stream

test-model-stream-pod:
	$(cd src)
	composer test-model-stream-pod

test-model-trinity-stream:
	$(cd src)
	composer test-model-trinity-stream

test-model-stream-topco:
	$(cd src)
	composer test-model-stream-topco

# docker exec -it -w "$(CURDIR)" php82 ./vendor/bin/phpunit --testdox --bootstrap ./tests/auto/models/config/stream.php tests/auto/models --debug

# Sanitize tools
pretty:
	# The tool is too tricky to be runned in make directly
	./tools/pretty-quick.sh

pretty-all:
	$(cd src)
	# composer pretty
	php vendor/bin/php-cs-fixer fix \
		--config=.php-cs-fixer.dist.php -v \
		src



# Catalogue wordpress tools
update-cms-images:
	#!/bin/bash
	cd tools/image-generator

	docker run -it --rm --privileged \
		-v /volume1/homes/protocolnebula/development-environment/www/conquer-online/tools/image-generator/:/app/ \
		-w /app \
		--pid=host node_custom:18 \
		npm i

	docker run -it --rm --privileged \
		-v /volume1/homes/protocolnebula/development-environment/www/conquer-online/tools/image-generator/:/app/ \
		-w /app \
		--pid=host node_custom:18 \
		npm start
