|
| 1 | +.PHONY: apigen compser test docs mkdocs |
| 2 | + |
| 3 | +PHONGO_LIB_VERSION=`php -r 'require "src/Collection.php"; echo MongoDB\Collection::VERSION, "\n";'` |
| 4 | +COMPOSER_ARGS=update --no-interaction --prefer-source |
| 5 | +PHPUNIT_ARGS=--process-isolation |
| 6 | + |
| 7 | +composer: |
| 8 | + @command -v composer >/dev/null 2>&1; \ |
| 9 | + if test $$? -eq 0; then \ |
| 10 | + composer $(COMPOSER_ARGS) ;\ |
| 11 | + elif test -r composer.phar; then \ |
| 12 | + php composer.phar $(COMPOSER_ARGS); \ |
| 13 | + else \ |
| 14 | + echo "Cannot find composer :("; \ |
| 15 | + echo "Aborting."; \ |
| 16 | + exit 1; \ |
| 17 | + fi |
| 18 | + |
| 19 | +test: composer |
| 20 | + @command -v phpunit >/dev/null 2>&1; \ |
| 21 | + if test $$? -eq 0; then \ |
| 22 | + phpunit $(PHPUNIT_ARGS) ;\ |
| 23 | + elif test -r phpunit.phar; then \ |
| 24 | + php phpunit.phar $(PHPUNIT_ARGS); \ |
| 25 | + else \ |
| 26 | + echo "Cannot find phpunit :("; \ |
| 27 | + echo "Aborting."; \ |
| 28 | + exit 1; \ |
| 29 | + fi |
| 30 | + |
| 31 | +apigen: |
| 32 | + @command -v apigen >/dev/null 2>&1; \ |
| 33 | + if test $$? -eq 0; then \ |
| 34 | + apigen generate |
| 35 | + elif test -r phpunit.phar; then \ |
| 36 | + php apigen generate \ |
| 37 | + else \ |
| 38 | + echo "Cannot find apigen :("; \ |
| 39 | + echo "Aborting."; \ |
| 40 | + exit 1; \ |
| 41 | + fi |
| 42 | + |
| 43 | +mkdocs: |
| 44 | + @command -v mkdocs >/dev/null 2>&1; \ |
| 45 | + if test $$? -eq 0; then \ |
| 46 | + mkdocs build --clean \ |
| 47 | + else \ |
| 48 | + echo "Cannot find apigen :("; \ |
| 49 | + echo "Aborting."; \ |
| 50 | + exit 1; \ |
| 51 | + fi |
| 52 | + |
| 53 | +docs-api: apigen |
| 54 | + |
| 55 | +docs: mkdocs |
| 56 | + |
| 57 | + |
| 58 | +release: test RELEASE |
| 59 | + @echo "Please run:" |
| 60 | + @echo " " git commit -m \"Add $(PHONGO_LIB_VERSION) release notes\" RELEASE-$(PHONGO_LIB_VERSION) |
| 61 | + @echo " " git tag -a -m \"Release phongo-library $(PHONGO_LIB_VERSION)\" $(PHONGO_LIB_VERSION) |
| 62 | + @echo " " git push --tags |
| 63 | + @echo " " make release-docs |
| 64 | + @echo "And don't forget to pump version in src/Collection.php" |
| 65 | + |
| 66 | +docs: |
| 67 | + mkdocs build --clean |
| 68 | + |
| 69 | +release-docs: docs |
| 70 | + mkdocs gh-deploy --clean |
| 71 | + |
| 72 | +RELEASE: |
| 73 | + @git log --pretty=format:"%ad %an <%ae>%n%x09* %s%n" --date short --since="$$(git show -s --format=%ad `git rev-list --tags --max-count=1`)" > RELEASE-$(PHONGO_LIB_VERSION) |
| 74 | + |
0 commit comments