Guest User

Untitled

a guest
Nov 20th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.58 KB | None | 0 0
  1. .SILENT:
  2. .PHONY: build test help server install
  3. .DEFAULT_GOAL= help
  4.  
  5. PORT?=8080
  6.  
  7. ## Colors
  8. COLOR_RESET = \033[0m
  9. COLOR_INFO = \033[32m
  10. COLOR_COMMENT = \033[33m
  11. COLOR_ERROR = \033[0;31m
  12. COLOR_COM = \033[0;34m
  13. COLOR_OBJ = \033[0;36m
  14.  
  15.  
  16. ## Help
  17. help:
  18. printf "${COLOR_COMMENT}Usage:${COLOR_RESET}\n"
  19. printf " make [target]\n\n"
  20. printf "${COLOR_COMMENT}Available targets:${COLOR_RESET}\n"
  21. awk '/^[a-zA-Z\-\_0-9\.@]+:/ { \
  22. helpMessage = match(lastLine, /^## (.*)/); \
  23. if (helpMessage) { \
  24. helpCommand = substr($$1, 0, index($$1, ":")); \
  25. helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
  26. printf " ${COLOR_INFO}%-16s${COLOR_RESET} %s\n", helpCommand, helpMessage; \
  27. } \
  28. } \
  29. { lastLine = $$0 }' $(MAKEFILE_LIST)
  30.  
  31. ###########
  32. # Install #
  33. ###########
  34.  
  35. composer.lock: composer.json
  36. composer update
  37.  
  38. vendor: composer.lock
  39. composer install --verbose
  40. bin/console doctrine:database:create --if-not-exists
  41.  
  42. ## Install application
  43. install: vendor
  44.  
  45. install@test: export SYMFONY_ENV = test
  46. install@test:
  47. # Composer
  48. composer install --verbose --no-progress --no-interaction
  49. # Doctrine
  50. bin/console doctrine:database:drop --force --if-exists
  51. bin/console doctrine:database:create --if-not-exists
  52. bin/console doctrine:schema:update --force
  53.  
  54. install@demo: export SYMFONY_ENV = prod
  55. install@demo:
  56. # Composer
  57. composer install --verbose --no-progress --no-interaction --prefer-dist --optimize-autoloader
  58. # Symfony cache
  59. bin/console cache:warmup --no-debug
  60. # Doctrine migrations
  61. bin/console doctrine:migrations:migrate --no-debug --no-interaction
  62.  
  63. install@prod: export SYMFONY_ENV = prod
  64. install@prod:
  65. # Composer
  66. composer install --verbose --no-progress --no-interaction --prefer-dist --optimize-autoloader --no-dev
  67. # Symfony cache
  68. bin/console cache:warmup --no-debug
  69. # Doctrine migrations
  70. bin/console doctrine:migrations:migrate --no-debug --no-interaction
  71.  
  72. ##########
  73. # Build #
  74. ##########
  75.  
  76. build:
  77. if [ -f "gulpfile" ]; then gulp --dev; fi;
  78. build@demo:
  79. if [ -f "gulpfile" ]; then gulp; fi;
  80. build@prod:
  81. if [ -f "gulpfile" ]; then gulp; fi;
  82.  
  83. ##########
  84. # Custom #
  85. ##########
  86.  
  87. cc:
  88. php bin/console cache:clear --no-warmup
  89. php bin/console cache:warmup
  90.  
  91. cc@prod: export SYMFONY_ENV = prod
  92. cc@prod:
  93. php bin/console cache:clear --no-warmup
  94. php bin/console cache:warmup
  95.  
  96. ## Lance les tests unitaire
  97. test: install
  98. php ./vendor/bin/phpunit --stop-on-failure
  99.  
  100. ## Nettoie le cache
  101. cache-clear:
  102. rm -rf ./tmp
  103.  
  104. ## Lance le serveur interne de PHP
  105. server: install
  106. ENV=dev php -ddisplay_errors=1 bin/console server:start 0.0.0.0:$(PORT)
  107.  
  108. ## Stoppe le serveur interne de PHP
  109. server@stop:
  110. php bin/console server:stop
Add Comment
Please, Sign In to add comment