Skip to content

[FrameworkBundle] improve Makefile serve target #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions symfony/framework-bundle/3.3/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,23 @@ cache-warmup: cache-clear
@test -f bin/console && bin/console cache:warmup || echo "cannot warmup the cache (needs symfony/console)"
.PHONY: cache-warmup

serve:
@echo -e "\033[32;49mServer listening on http://127.0.0.1:8000\033[39m"
@echo "Quit the server with CTRL-C."
@echo -e "Run \033[32mcomposer require symfony/web-server-bundle\033[39m for a better web server"
CONSOLE=bin/console
sf_console:
@test -f $(CONSOLE) || printf "Run \033[32mcomposer require cli\033[39m to install the Symfony console.\n"
@exit

serve_as_sf: sf_console
@test -f $(CONSOLE) && $(CONSOLE)|grep server:start > /dev/null || ${MAKE} serve_as_php
@$(CONSOLE) server:start || exit 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exit with 1 when the server fails to start looks wrong to me


@printf "Quit the server with \033[32;49mbin/console server:stop.\033[39m\n"

serve_as_php:
@printf "\033[32;49mServer listening on http://127.0.0.1:8000\033[39m\n";
@printf "Quit the server with CTRL-C.\n"
@printf "Run \033[32mcomposer require symfony/web-server-bundle\033[39m for a better web server\n"
php -S 127.0.0.1:8000 -t web
.PHONY: serve

serve:
@${MAKE} serve_as_sf
.PHONY: sf_console serve serve_as_sf serve_as_php