washingtonstateuniversity / cahnrswp-plugin-pagebuilder

Revised version of CAHNRS Pagebuilder. Pagebuilder allows for highly customizable page layouts.
Other
1 stars 0 forks source link

WSUWP Plugin Skeleton

Build Status

A framework for building a WordPress plugin at WSU.

Initial setup

Setup the plugin repository

  1. Create a new repository under the Washington State University organization. This should have a name like "WSUWP Plugin New Feature".
  2. Clone this WSUWP Plugin Skeleton repository to a directory on your computer named for the new plugin.
  3. Change into that new directory.
  4. Remove the .git directory that provides the history for the WSUWP Plugin Skeleton project.
  5. Initialize a new git repository in the directory.
  6. Add the new repository you created in step 1 as the origin remote.

In terminal

git clone https://github.com/washingtonstateuniversity/WSUWP-Plugin-Skeleton.git wsuwp-new-feature
cd wsuwp-new-feature
rm -fr .git
git init
git remote add origin https://github.com/washingtonstateuniversity/WSUWP-Plugin-New-Feature.git
git status

Alter the plugin to be its own project

There are several places throughout the WSUWP Plugin Skeleton code that should be changed to match the new plugin.

  1. The main includes/ file, includes/wsuwp-plugin-skeleton.php, should be renamed to match the new plugin's slug.
  2. The main tests/ file, tests/test-wsuwp-plugin-skeleton.php, should be renamed to match the new plugin's slug.
  3. The namespace used in includes/ files should be updated to reflect the new plugin.
  4. Update the plugin headers in plugin.php to provide the project name, description, authors, etc...
  5. Update the project name in composer.json.
  6. Update the project name and URL in package.json.
  7. Update the ruleset name and description in phpcs.ruleset.xml.
  8. Update the name and description of the project in README.md, replacing all of this text.
  9. Update the name, copyright, and URL in LICENSE.

After completing these, search for the terms "WSUWP Plugin Skeleton", "WSUWP_Plugin_Skeleton", and "wsuwp-plugin-skeleton" to be sure that all uses were caught.

Testing the initial plugin structure

  1. Install the NPM dependencies.
  2. Install the Composer dependencies.
  3. Ensure code standards are sniffed properly.
  4. Ensure unit tests are running properly.

In terminal

npm install
composer install
grunt phpcs
phpunit

If you have not previously setup unit tests for WordPress projects, phpunit will not run properly. Use the test install script in the bin directory to setup a base for testing locally.

sh bin/install-wp-tests.sh wordpress_tests root ''

Add the updated plugin files to the repository

The plugin should now be in its initial state, with all pieces renamed to fit the new project. An initial commit can be added with all of these files.

  1. Check git status to be sure only the intended files are being added.
  2. Add all files to staging.
  3. Add an initial commit.
  4. Push the initial commit to the master branch on the origin remote.

In terminal

git status
git add -A
git commit -m "Initial commit"
git push origin master

Adding the project to Travis CI for continuous integration testing

The repository provides a .travis.yml configuration file for use with Travis CI. As a member of the WSU organization, you should be able to enable your new repository for continuous integration under the WSU Profile.

Look at the general settings for this project to view how new projects should be configured.