Skip to content

Instantly share code, notes, and snippets.

@mikeflynn
Last active June 19, 2019 05:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikeflynn/176c35430a141641ef2c to your computer and use it in GitHub Desktop.
Save mikeflynn/176c35430a141641ef2c to your computer and use it in GitHub Desktop.
Example Wordpress Makefile
include ../_global/wordpress.mk
wpconfig:
@./wp core config --dbname=example_site --dbuser=root --dbpass=root --path=./wordpress --skip-check;
theme:
@echo "Theme file found."
@unzip theme.zip -d wordpress/wp-content/themes
plugins: plugin-aws plugin-amazon-s3 plugin-importer
plugin-amazon-s3:
curl -O https://downloads.wordpress.org/plugin/amazon-s3-and-cloudfront.0.9.10.zip;
@unzip amazon-s3-and-cloudfront.0.9.10 -d wordpress/wp-content/plugins
@rm -rf amazon-s3-and-cloudfront.0.9.10.zip
plugin-aws:
curl -O https://downloads.wordpress.org/plugin/amazon-web-services.zip;
@unzip amazon-web-services.zip -d wordpress/wp-content/plugins
@rm -rf amazon-web-services.zip
plugin-importer:
curl -O https://downloads.wordpress.org/plugin/wordpress-importer.0.6.1.zip;
@unzip wordpress-importer.0.6.1.zip -d wordpress/wp-content/plugins
@rm -rf wordpress-importer.0.6.1.zip
install: clean wordpress wp-cli wpconfig theme content plugins
wordpress: latest.tar.gz
@tar -xzvf latest.tar.gz;
@rm -rf latest.tar.gz wordpress/license.txt wordpress/readme.html wordpress/wp-content/plugins/akismet wordpress/wp-content/plugins/hello.php;
@mkdir -p wordpress/wp-content/plugins;
@mkdir -p wordpress/wp-content/themes;
latest.tar.gz:
@curl -O https://wordpress.org/latest.tar.gz;
ifneq ($(wildcard content.xml),)
content:
@echo "Found content file."
@./wp import ./content.xml --path=./wordpress
else
content:
@echo "No content file."
@echo "$(realpath $(./content.xml))"
endif
wp-cli:
@curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
@chmod +x wp-cli.phar
@ln -s wp-cli.phar ./wp
clean:
rm -rf wordpress
rm -rf latest.tar.gz wordpress;
rm -rf wp-cli.phar
rm -rf wp
ifneq ($(wildcard wp-config.patch.txt),)
deploy:
@echo "Applying local wp-config patch."
@patch -p0 < wp-config.patch.txt
else
deploy:
@echo "Applying global wp-config patch."
@patch -p0 < ../_global/wp-config.patch.txt
endif
help:
@echo "Makefile usage:";
@echo " make \t\t Get Wordpress application files"
@echo " make clean \t Delete Wordpress files"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment