Skip to content

Commit

Permalink
Added changephp command
Browse files Browse the repository at this point in the history
  • Loading branch information
JeroenBoersma committed Jul 30, 2018
1 parent e61df92 commit 273394d
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
35 changes: 35 additions & 0 deletions bin/dev_command/changephp
Original file line number Diff line number Diff line change
@@ -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;
4 changes: 4 additions & 0 deletions docs/development-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -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`
Expand Down

0 comments on commit 273394d

Please sign in to comment.