A framework for building a WordPress plugin at WSU.
- Create a new repository under the Washington State University organization. This should have a name like "WSUWP Plugin New Feature".
- Clone this WSUWP Plugin Skeleton repository to a directory on your computer named for the new plugin.
- Change into that new directory.
- Remove the
.git
directory that provides the history for the WSUWP Plugin Skeleton project. - Initialize a new git repository in the directory.
- Add the new repository you created in step 1 as the
origin
remote.
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
There are several places throughout the WSUWP Plugin Skeleton code that should be changed to match the new plugin.
- The main
includes/
file,includes/wsuwp-plugin-skeleton.php
, should be renamed to match the new plugin's slug. - The main
tests/
file,tests/test-wsuwp-plugin-skeleton.php
, should be renamed to match the new plugin's slug. - The namespace used in
includes/
files should be updated to reflect the new plugin. - Update the plugin headers in
plugin.php
to provide the project name, description, authors, etc... - Update the project name in
composer.json
. - Update the project name and URL in
package.json
. - Update the ruleset name and description in
phpcs.ruleset.xml
. - Update the name and description of the project in
README.md
, replacing all of this text. - 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.
- Install the NPM dependencies.
- Install the Composer dependencies.
- Ensure code standards are sniffed properly.
- Ensure unit tests are running properly.
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 ''
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.
- Check
git status
to be sure only the intended files are being added. - Add all files to staging.
- Add an initial commit.
- Push the initial commit to the master branch on the origin remote.
git status
git add -A
git commit -m "Initial commit"
git push origin master
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.