Skip to content

Commit d638de4

Browse files
committed
refactor: drop composer dependency in favor of vendored composer files
This will avoid the need to run PHP 5.6 or below in order to get `composer update` to run properly, meaning developers with PHP 7 on their workstations can still use this workflow.
1 parent 128b6f5 commit d638de4

File tree

5 files changed

+25
-8
lines changed

5 files changed

+25
-8
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@
44
!LICENSE.txt
55
!.editorconfig
66
!.gitignore
7+
!config/composer.json
8+
!config/composer.lock
79
!config/wp-config.php

Makefile

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ ifndef MYSQL_IMAGE_VERSION
1414
MYSQL_IMAGE_VERSION = 5.6.34
1515
endif
1616

17-
COMPOSER := $(shell command -v composer 2> /dev/null)
18-
1917

2018
.PHONY: all
2119
all: help ## outputs the help message
@@ -31,9 +29,6 @@ ifndef APP_NAME
3129
endif
3230
ifndef SERVER_NAME
3331
$(error "Missing SERVER_NAME environment variable, this should be something like 'dokku.me'")
34-
endif
35-
ifndef COMPOSER
36-
$(error "composer binary is not available, please install composer into your system path")
3732
endif
3833
# creating the wordpress repo
3934
@test -d $(APP_NAME) || (git clone --quiet https://github.com/WordPress/WordPress.git $(APP_NAME) && cd $(APP_NAME) && git checkout -q tags/$(WORDPRESS_VERSION) && git branch -qD master && git checkout -qb master)
@@ -42,8 +37,7 @@ endif
4237
# adding .env file to configure buildpack
4338
@test -f $(APP_NAME)/.buildpacks || (echo "https://github.com/heroku/heroku-buildpack-php.git#$(BUILDPACK_VERSION)" > $(APP_NAME)/.buildpacks && cd $(APP_NAME) && git add .buildpacks && git commit -qm "Forcing php buildpack usage")
4439
# ensuring our composer.json loads with php 5.6 and loads the mysql extension
45-
# run `composer install` if dokku complains about missing a composer.lock
46-
@test -f $(APP_NAME)/composer.json || (echo '{"require": {"php": ">=5.6", "ext-mysql": "*"}}' > $(APP_NAME)/composer.json && cd $(APP_NAME) && composer update && git add composer.json composer.lock && git commit -qm "Use PHP 5.6 and the mysql extension")
40+
@test -f $(APP_NAME)/composer.json || (cp config/composer.json $(APP_NAME)/composer.json && cp config/composer.lock $(APP_NAME)/composer.lock && cd $(APP_NAME) && git add composer.json composer.lock && git commit -qm "Use PHP 5.6 and the mysql extension")
4741
# setting the correct dokku remote for your app and server combination
4842
@cd $(APP_NAME) && (git remote rm dokku 2> /dev/null || true) && git remote add dokku "dokku@$(SERVER_NAME):$(APP_NAME)"
4943
# retrieving potential salts and writing them to /tmp/wp-salts

README.markdown

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ A repository to help you setup WordPress on a Dokku server.
66

77
- A Dokku server. Tested on 0.7.2+
88
- The [dokku-mysql](https://github.com/dokku/dokku-mysql) plugin
9-
- PHP 5.x and Composer installed locally (to run `composer update` correctly)
109
- `make` installed locally
1110

1211
## Usage

config/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"require": {"php": ">=5.6", "ext-mysql": "*"}}

config/composer.lock

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)