Skip to content

Setting Up Development Environment

Jake Oehler Morrison edited this page Sep 26, 2019 · 1 revision

This page will guide you through the process of setting up WP Job Manager development environment on your local machine. It should work on Linux, macOS, or Windows 10 with the Linux Subsystem.

Table of Contents

Pre-requisites

Before starting, make sure you have the following software installed and working on your machine:

  1. Git to clone the WP Job Manager repository (or your fork of the WP Job Manager repository).
  2. NPM to install Node packages used to build assets and other tasks.
  3. Composer to install PHP packages required by WP Job Manager such as the wp-job-manager-rest-api and the jetpack-autoloader. It's also necessary to use the PHP CodeSniffer that ensures your code follows code standards.

Configure a local WordPress instance

For this guide we will use VVV, which is a local WordPress development environment built using Vagrant and VirtualBox, to run a local WordPress instance and install WP Job Manager on top of it. But it is worth noting that it is possible to set up a WP Job Manager development environment using several other stacks (docker, LAMP, etc). If you opt to use a solution other than VVV, you can skip to the next section. Keep in mind that you might need to make some small adjustments to the steps in the rest of this guide.

To configure our local WordPress instance, you will need to:

  1. Install VirtualBox
  2. Install vagrant
  3. Install and provision VVV
  4. If everything worked as expected, you should have a WordPress installation running on the following URL: https://one.wordpress.test. This is the WP site that we will use to install WP Job Manager.

Clone WP Job Manager repository

To install WP Job Manager on your WordPress installation, you need to decide whether you will clone the WP Job Manager repository directly or your WP Job Manager fork. If you plan to contribute to WP Job Manager code base, it is recommended that you clone your fork. If needed, see this GitHub document on how to create a fork.

In your terminal:

  1. Go to the WordPress plugins directory:
    $ cd ~/vagrant-local/www/wordpress-one/public_html/wp-content/plugins/
    
  2. Clone the repository:
    • If cloning WP Job Manager repository:
    $ git clone git@github.com:Automattic/WP-Job-Manager.git
    
    • If cloning your own fork replace USER_NAME with your GitHub username:
    $ git clone git@github.com:USER_NAME/WP-Job-Manager.git
    

Install dependencies and generate assets

To install WP Job Manager dependencies (this includes some functionality that installs git pre-commit hooks for code style checks and Grunt that is used to generated minified versions of the SCSS and JS files):

$ cd ~/vagrant-local/www/wordpress-one/public_html/wp-content/plugins/wp-job-manager
$ npm install
$ composer install

To generate JS and CSS assets run the following command from the WP Job Manager root directory:

npm run build

To automatically rebuild the assets whenever a JS or SCSS file is modified run:

npm run build-watch

IDE integrations

WP Job Manager core has linting rules in place via pre-commit hooks to ensure code standards are used. Ensure you have installed NPM and Composer packages, so these are set up!

While developing, we recommend adding support to your editor for the following (most IDEs have plugins for this):

Additional resources

Running unit tests