Makefile 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. .PHONY: all coverage coverage-js coverage-php doc doc-js doc-php increment sign test test-js test-php help
  2. CURRENT_VERSION = 1.6.0
  3. VERSION ?= 1.6.1
  4. VERSION_FILES = index.php bin/ cfg/ *.md doc/Installation.md css/ i18n/ img/ js/package.json js/privatebin.js lib/ Makefile tpl/ tst/
  5. REGEX_CURRENT_VERSION := $(shell echo $(CURRENT_VERSION) | sed "s/\./\\\./g")
  6. REGEX_VERSION := $(shell echo $(VERSION) | sed "s/\./\\\./g")
  7. all: coverage doc ## Equivalent to running `make coverage doc`.
  8. composer: ## Update composer dependencies (only production ones, optimize the autoloader)
  9. composer update --no-dev --optimize-autoloader
  10. coverage: coverage-js coverage-php ## Run all unit tests and generate code coverage reports.
  11. coverage-js: ## Run JS unit tests and generate code coverage reports.
  12. cd js && nyc mocha
  13. coverage-php: ## Run PHP unit tests and generate code coverage reports.
  14. cd tst && phpunit 2> /dev/null
  15. cd tst/log/php-coverage-report && sed -i "s#$(CURDIR)##g" *.html */*.html
  16. doc: doc-js doc-php ## Generate all code documentation.
  17. doc-js: ## Generate JS code documentation.
  18. jsdoc -p -d doc/jsdoc js/privatebin.js js/legacy.js
  19. doc-php: ## Generate JS code documentation.
  20. phpdoc --visibility public,protected,private -t doc/phpdoc -d lib/
  21. increment: ## Increment and commit new version number, set target version using `make increment VERSION=1.2.3`.
  22. for F in `grep -l -R $(REGEX_CURRENT_VERSION) $(VERSION_FILES) | grep -v -e tst/log/ -e ":0" -e CHANGELOG.md`; \
  23. do \
  24. sed -i "s/$(REGEX_CURRENT_VERSION)/$(REGEX_VERSION)/g" $$F; \
  25. done
  26. cd tst && phpunit --no-coverage && cd ..
  27. git add $(VERSION_FILES) tpl/
  28. git commit -m "incrementing version"
  29. sign: ## Sign a release.
  30. git tag --sign --message "Release v$(VERSION)" $(VERSION)
  31. git push origin $(VERSION)
  32. signrelease.sh
  33. test: test-js test-php ## Run all unit tests.
  34. test-js: ## Run JS unit tests.
  35. cd js && mocha
  36. test-php: ## Run PHP unit tests.
  37. cd tst && phpunit --no-coverage
  38. help: ## Displays these usage instructions.
  39. @echo "Usage: make <target(s)>"
  40. @echo
  41. @echo "Specify one or multiple of the following targets and they will be processed in the given order:"
  42. @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "%-16s%s\n", $$1, $$2}' $(MAKEFILE_LIST)