diff --git a/docker/usr/local/bin/php_helper.sh b/docker/usr/local/bin/php_helper.sh index 5c6a4de..8a2177b 100755 --- a/docker/usr/local/bin/php_helper.sh +++ b/docker/usr/local/bin/php_helper.sh @@ -9,27 +9,10 @@ if [ -f /usr/local/etc/php/php.ini-$ENVIRONMENT ]; then fi -if [ $PHP_VERSION = '72' ]; then +if [ $PHP_VERSION == '72' ]; then wget -O /bin/composer https://getcomposer.org/composer-1.phar else wget -O /bin/composer https://getcomposer.org/composer.phar fi chmod a+x /bin/composer - - -if [ $PHP_VERSION = '72' ]; then - composer global require hirak/prestissimo -fi - -if [ $ENVIRONMENT != 'production' ]; then - wget -O phpunit https://phar.phpunit.de/phpunit-9.phar - install phpunit /usr/local/bin -fi - -if [ $ENVIRONMENT = 'development' ]; then - apk --update --no-cache add autoconf g++ make - pecl install -f xdebug - docker-php-ext-enable xdebug - apk del --purge autoconf g++ make -fi diff --git a/docker/usr/local/bin/project_setup b/docker/usr/local/bin/project_setup index 67a16a7..d3fd10d 100755 --- a/docker/usr/local/bin/project_setup +++ b/docker/usr/local/bin/project_setup @@ -1,5 +1,6 @@ #!/bin/sh + if [ -f /var/www/override.ini ]; then rm /usr/local/etc/php/conf.d/02-project-override.ini ln -s /var/www/override.ini /usr/local/etc/php/conf.d/02-project-override.ini diff --git a/docker/usr/local/bin/xdebug_enable b/docker/usr/local/bin/xdebug_enable new file mode 100755 index 0000000..c47505e --- /dev/null +++ b/docker/usr/local/bin/xdebug_enable @@ -0,0 +1,35 @@ +#!/bin/bash + +# +# Helper functions +# +declare -i term_width=80 + +h1() { + declare border padding text + border='\e[1;34m'"$(printf '=%.0s' $(seq 1 "$term_width"))"'\e[0m' + padding="$(printf ' %.0s' $(seq 1 $(((term_width - $(wc -m <<<"$*")) / 2))))" + text="\\e[1m$*\\e[0m" + echo -e "$border" + echo -e "${padding}${text}${padding}" + echo -e "$border" +} + +h2() { + printf '\e[1;33m==>\e[37;1m %s\e[0m\n' "$*" +} + +h1 "Actual environment: ${ENVIRONMENT}" + +if [ $ENVIRONMENT != 'production' ]; then + wget -O phpunit https://phar.phpunit.de/phpunit-9.phar + install phpunit /usr/local/bin +fi + +if [ $ENVIRONMENT == 'development' ]; then + h2 "Install xdebug" + apk --update --no-cache add autoconf g++ make + pecl install -f xdebug + docker-php-ext-enable xdebug + apk del --purge autoconf g++ make +fi