From 273394dc8f995800b3d2e6abec87df55c4504637 Mon Sep 17 00:00:00 2001 From: Jeroen Boersma Date: Mon, 30 Jul 2018 13:11:23 +0200 Subject: [PATCH] Added changephp command --- bin/dev_command/changephp | 35 +++++++++++++++++++++++++++++++++++ docs/development-commands.md | 4 ++++ 2 files changed, 39 insertions(+) create mode 100644 bin/dev_command/changephp diff --git a/bin/dev_command/changephp b/bin/dev_command/changephp new file mode 100644 index 0000000..ca31a90 --- /dev/null +++ b/bin/dev_command/changephp @@ -0,0 +1,35 @@ + +echo 'PHP configured version '${DEV_PHP}; + +local versions="`dc php_versions`" v='' version='' dir=${DEV_WORKDIR}/workspace; + +if [ -z "$1" ]; then + exit 0; +fi + +for v in ${versions}; do + if [ "$1" == "${v}" ]; then + version=${v}; + fi +done + +if [ -z "${version}" ]; then + echo 'Provide valid PHP version `dev changephp {VERSION}`'; + echo ${versions}; + exit 1; +fi + +if [ "${version}" == "${DEV_PHP}" ]; then + exit 2; +fi + +if [ -n "${DEV_PROJECTDIR}" ]; then + dir=${DEV_WORKDIR}/workspace/${DEV_PROJECTDIR}; +fi + +echo 'Update to '${version}; + +rm ${dir}/.php[1-9][0-9] >/dev/null 2>&1; +touch ${dir}/.${version}; + +exit 0; diff --git a/docs/development-commands.md b/docs/development-commands.md index 83ea77e..3c03725 100644 --- a/docs/development-commands.md +++ b/docs/development-commands.md @@ -6,6 +6,8 @@ To control your docker environment. - `build [IMAGE]` re-build a image +- `changephp` + change current php version - `config` show docker-compose configuration - `down` @@ -26,6 +28,8 @@ To control your docker environment. alias for `dev update && dev build && dev down && dev up` - `restart [CONTAINER]` restart all or a specific container +- `setup` + Run setup for defaults - `start` start all exising container, will not create them if they don't exist(use `up` instead) - `status`