Skip to content

Instantly share code, notes, and snippets.

@saxenap
Last active April 30, 2016 23:37
Show Gist options
  • Save saxenap/e4b65f41fb6ebb5185e8fff06974f8a6 to your computer and use it in GitHub Desktop.
Save saxenap/e4b65f41fb6ebb5185e8fff06974f8a6 to your computer and use it in GitHub Desktop.
Makefile to install (very insecure) development WordPress
# rm -rf Makefile && wget -O Makefile https://gist.githubusercontent.com/saxenap/e4b65f41fb6ebb5185e8fff06974f8a6/raw
ROOT_DIR :=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
USER = USER
PASSW = PASSWORD
TITLE ?= test_site
USER_EMAIL ?= [email protected]
URL ?= $(shell curl http://169.254.169.254/latest/meta-data/public-ipv4)
BUILD_PATH ?= $(ROOT_DIR)/build
DBHOST ?= localhost
DBNAME ?= wordpress_$(shell date +%s)
DBUSER ?= root
DBPASS ?=
DBCOLLATE ?=
DBCHARSET ?= utf8
SKIP_THEMES = twentyfifteen twentyfourteen twentythirteen
SKIP_PLUGINS = hello akismet
INSTALL_PLUGINS = debug-bar log-deprecated-notices simply-show-ids wordpress-reset query-monitor
WPCLI ?= wp
WP ?= $(WPCLI) --allow-root
define wpcliyml
path: $(BUILD_PATH)
url: $(URL)
user: $(USER)
debug: true
core config:
dbhost: $(DBHOST)
dbname: $(DBNAME)
dbuser: $(DBUSER)
dbpass: $(DBPASS)
dbcharset: $(DBCHARSET)
dbcollate: $(DBCOLLATE)
extra-php: |
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', true );
core install:
title: $(TITLE)
admin_user: $(USER)
admin_password: $(PASS)
admin_email: $(USER_EMAIL)
endef
export wpcliyml
install-wpcli:
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
@chmod 755 wp-cli.phar
@rm -rf /usr/local/bin/wp /usr/bin/$(WPCLI)
@sudo mv wp-cli.phar /usr/local/bin/$(WPCLI)
@sudo ln -s /usr/local/bin/wp /usr/bin/$(WPCLI)
echo "Installed: WP-CLI."
all: install-wpcli
rm -rf $(BUILD_PATH) && mkdir $(BUILD_PATH)
$(WP) core download --path=$(BUILD_PATH)
rm -rf wp-cli.yml
echo "$$wpcliyml" >> wp-cli.yml
$(WP) core config
$(WP) db create
$(WP) core install
$(WP) theme delete $(SKIP_THEMES)
$(WP) plugin delete $(SKIP_PLUGINS)
$(WP) plugin install $(INSTALL_PLUGINS)
$(WP) plugin activate $(INSTALL_PLUGINS)
rm -rf $(BUILD_PATH)/license.txt $(BUILD_PATH)/readme.html
test:
test
test
test
test
@saxenap
Copy link
Author

saxenap commented Apr 12, 2016

make all USER=admin PASS=password

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment