2020-04-02 01:47:29 -04:00
|
|
|
.PHONY: all coverage coverage-js coverage-php doc doc-js doc-php increment sign test test-js test-php help
|
|
|
|
|
2024-07-09 14:35:59 -04:00
|
|
|
CURRENT_VERSION = 1.7.4
|
2024-05-13 13:18:30 -04:00
|
|
|
VERSION ?= 1.7.4
|
2024-05-28 14:58:12 -04:00
|
|
|
VERSION_FILES = README.md SECURITY.md doc/Installation.md js/package*.json lib/Controller.php Makefile
|
2020-04-02 01:47:29 -04:00
|
|
|
REGEX_CURRENT_VERSION := $(shell echo $(CURRENT_VERSION) | sed "s/\./\\\./g")
|
|
|
|
REGEX_VERSION := $(shell echo $(VERSION) | sed "s/\./\\\./g")
|
|
|
|
|
|
|
|
all: coverage doc ## Equivalent to running `make coverage doc`.
|
|
|
|
|
2021-04-05 11:11:51 -04:00
|
|
|
composer: ## Update composer dependencies (only production ones, optimize the autoloader)
|
|
|
|
composer update --no-dev --optimize-autoloader
|
|
|
|
|
2020-04-02 01:47:29 -04:00
|
|
|
coverage: coverage-js coverage-php ## Run all unit tests and generate code coverage reports.
|
|
|
|
|
|
|
|
coverage-js: ## Run JS unit tests and generate code coverage reports.
|
|
|
|
cd js && nyc mocha
|
|
|
|
|
|
|
|
coverage-php: ## Run PHP unit tests and generate code coverage reports.
|
2024-02-11 09:10:01 -05:00
|
|
|
cd tst && XDEBUG_MODE=coverage phpunit 2> /dev/null
|
2023-12-03 07:40:04 -05:00
|
|
|
cd tst/log/php-coverage-report && sed -i "s#$(CURDIR)/##g" *.html */*.html
|
2020-04-02 01:47:29 -04:00
|
|
|
|
|
|
|
doc: doc-js doc-php ## Generate all code documentation.
|
|
|
|
|
|
|
|
doc-js: ## Generate JS code documentation.
|
|
|
|
jsdoc -p -d doc/jsdoc js/privatebin.js js/legacy.js
|
|
|
|
|
|
|
|
doc-php: ## Generate JS code documentation.
|
2023-12-03 07:54:35 -05:00
|
|
|
phpdoc --visibility=public,protected,private --target=doc/phpdoc --directory=lib/
|
2020-04-02 01:47:29 -04:00
|
|
|
|
|
|
|
increment: ## Increment and commit new version number, set target version using `make increment VERSION=1.2.3`.
|
2024-05-28 14:58:12 -04:00
|
|
|
for F in `grep -l -R $(REGEX_CURRENT_VERSION) $(VERSION_FILES)`; \
|
2020-04-02 01:47:29 -04:00
|
|
|
do \
|
|
|
|
sed -i "s/$(REGEX_CURRENT_VERSION)/$(REGEX_VERSION)/g" $$F; \
|
|
|
|
done
|
2024-05-28 14:58:12 -04:00
|
|
|
git add $(VERSION_FILES)
|
2020-04-02 01:47:29 -04:00
|
|
|
git commit -m "incrementing version"
|
|
|
|
|
|
|
|
sign: ## Sign a release.
|
2022-12-11 00:15:13 -05:00
|
|
|
git tag --sign --message "Release v$(VERSION)" $(VERSION)
|
2022-04-05 01:29:07 -04:00
|
|
|
git push origin $(VERSION)
|
2020-04-02 01:47:29 -04:00
|
|
|
signrelease.sh
|
|
|
|
|
|
|
|
test: test-js test-php ## Run all unit tests.
|
|
|
|
|
|
|
|
test-js: ## Run JS unit tests.
|
|
|
|
cd js && mocha
|
|
|
|
|
|
|
|
test-php: ## Run PHP unit tests.
|
|
|
|
cd tst && phpunit --no-coverage
|
|
|
|
|
|
|
|
help: ## Displays these usage instructions.
|
|
|
|
@echo "Usage: make <target(s)>"
|
|
|
|
@echo
|
|
|
|
@echo "Specify one or multiple of the following targets and they will be processed in the given order:"
|
|
|
|
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "%-16s%s\n", $$1, $$2}' $(MAKEFILE_LIST)
|