Skip to content

charlesmulder/wordpresser

Repository files navigation

Wordpresser

Library used by our WordPress themes and plugins to simplify ops.

# creates local container with multisite install
dep multisite local

# clone production multisite to local
dep clone local
# clone production multisite to staging
dep clone staging

# replaces local db with production db
dep sync:db local
# replaces staging db with production db
dep sync:db staging

# replaces local wp-content with production wp-content
dep sync:content local
# replaces staging wp-content with production wp-content
dep sync:content staging

# deploy theme to staging environment
dep deploy staging
# deploy theme to production environment
dep deploy production
# undo previous deployment to staging environment
dep rollback staging
# undo previous deployment to production environment
dep rollback production

NB: Make sure your public SSH key is on the staging and production server and added to your local ssh-agent.

Tests

WordPresser interacts with local docker containers running on developer workstations as well as remote servers used for staging and production sites. The tests interact with four docker containers. Two of which represent the local developer workstations and the remaining two representing the remote web servers. Interaction with remote servers is via SSH using a PHP deployment tool called Deployer.

# add your private SSH key to your workstation ssh-agent
ssh-add ~/.ssh/id_rsa
# tests rely on a running docker container with access to your public SSH key
PUBLIC_KEY=$(ssh-add -L) docker-compose up 
# run all tests
composer lint && composer test 
# run tests for specific group ie. the helper
composer lint && composer test -- --group=helper

Please take a look at the Composer scripts contained within the projects composer.json file for insight into how the tests are run.

Dependencies

Wordpresser relies on:

The dependencies are listed in the composer.json file.

Installing

To use Wordpresser in your WordPress theme or plugin add the repository to your composer.json file.

"repositories": [
    {
        "type": "vcs",
        "url":  "git@gitlab.host-h.net:charlesmulder/wordpresser.git" 
    },

],

Now add the package as a dependency to your project

composer require --dev vegashero/wordpresser
composer install

As per standard composer convention, Wordpresser will be autoloaded when adding the following to your php file.

require_once __DIR__ . '/vendor/autoload.php';

Development

During development of Wordpresser it is possible to reference your local WordPresser project from your WordPress theme or plugin by adding the local repository to your composer.json file.

composer remove vegashero/wordpresser
"repositories": [
    {
        "type": "path",
        "url": "../wordpresser",
        "options": {
            "symlink": true
        }
    }
],

Now add the package as a development dependency to your project.

composer require --dev vegashero/wordpresser @dev
composer install

Release a new version

# list previously tagged releases
git tag -l
# create a new tag
git tag -a v1.1.3
# release the tag
git push origin v1.1.3

Resources

About

Library used by our WordPress themes and plugins to simplify ops.

Resources

Stars

Watchers

Forks

Packages

No packages published