Skip to content

Commit 551bd88

Browse files
authored
sync.sh: update or install but not both (#512)
We should probably either update or install (using the lock file) if it is present but not try to install and then update. In the case that an update is needed because of a change to either composer.json or to a composer.json included from composer-merge-plugin we don't want to try an install only to have it fail (and then the script exit early) This commit therefore also renames the bash ENV var to be clearer
1 parent f705246 commit 551bd88

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

sync.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,21 @@ Help()
2323
}
2424

2525
# Set variable defaults
26-
ALSO_COMPOSER_UPDATE=""
26+
COMPOSER_UPDATE=""
2727

2828
# Get the options
2929
while getopts ":uh" option; do
3030
case $option in
3131
u)
32-
ALSO_COMPOSER_UPDATE="1";;
32+
COMPOSER_UPDATE="1";;
3333
h) # display Help
3434
Help
3535
exit;;
3636
esac
3737
done
3838

3939
# Export vars for other scripts
40-
export ALSO_COMPOSER_UPDATE=${ALSO_COMPOSER_UPDATE}
40+
export COMPOSER_UPDATE=${COMPOSER_UPDATE}
4141

4242
# includes filenames beginning with a '.' in the results of filename expansion (/*)
4343
shopt -s dotglob

sync/04-docker-composer.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,16 @@ cp -r "$COMPOSER_WORK_DIR"/vendor "$PWD"/dist
3939
# composer install
4040
COMPOSER_WORK_DIR="$PWD"/dist
4141

42-
echo "Performing composer install with composer-merge plugin"
43-
composer_in_docker install --no-dev --no-progress --optimize-autoloader
4442

45-
# composer update (When ALSO_COMPOSER_UPDATE = 1)
46-
if [ "${ALSO_COMPOSER_UPDATE}" = "1" ]; then
47-
echo "Performing composer update"
43+
44+
# composer update (When COMPOSER_UPDATE = 1)
45+
if [ "${COMPOSER_UPDATE}" = "1" ]; then
46+
echo "Performing composer update with composer-merge plugin"
4847
composer_in_docker update --no-dev --no-progress --optimize-autoloader
4948
cp dist/composer.lock dist-persist/
5049
else
51-
echo "SKIPPING: composer update (As you didn't request it)"
50+
echo "Performing composer install with composer-merge plugin"
51+
composer_in_docker install --no-dev --no-progress --optimize-autoloader
5252
fi;
5353

5454
# Sometimes composer git clones things rather than using zips.

0 commit comments

Comments
 (0)