Skip to content

Instantly share code, notes, and snippets.

@gnowland
Last active September 30, 2020 05:36
Show Gist options
  • Save gnowland/84b5a933dafcac8a10a708840fcf58ee to your computer and use it in GitHub Desktop.
Save gnowland/84b5a933dafcac8a10a708840fcf58ee to your computer and use it in GitHub Desktop.
Makefile get_input
ifdef APP_EXISTS # If app directory already exists
@printf "# checking whether composer.json file has changed..."
ifeq ($(shell sed 's/PHP_VERSION/$(PHP_VERSION)/' src/composer.json | cmp -s - $(APP_NAME)/composer.json && echo false || echo true),true)
@printf " it has\n"
@echo update composer? [Y/n]
@read line; if [[ $$line = "y" || $$line = "Y" ]]; then make composer_update; fi
else
@printf " it's the same\n"
endif
else
@make composer_update
endif
.PHONY: composer_update ## update composer packages in the app
composer_update:
@echo "# ensuring the composer.json loads php $(PHP_VERSION) with the ext-gd extension providing PNG, JPEG and FreeType support";
@echo "# ...hang tight, this could take a minute or more...";
@(sed 's/PHP_VERSION/$(PHP_VERSION)/' src/composer.json > $(APP_NAME)/composer.json && cd $(APP_NAME) && php /usr/local/bin/composer.phar install --ignore-platform-reqs && rm -rf vendor && git add composer.json composer.lock && git diff-index --quiet --cached HEAD || git commit -qm "Use PHP $(PHP_VERSION) with ext-gd extension")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment