Skip to content

Contributors Quick Start

Tonya Mork edited this page Jun 20, 2018 · 7 revisions

Let's get you set up and ready to start writing code and tests. This Quick Start Guide gives you what you need to:

  1. Setup your machine.
  2. Interact with git and GitHub - See the Git Cheatsheet
  3. Run the tests and sniffers.
  4. Push Pull Requests (PR) to Beans for code review.

Ready? Let's go.

Setting Up Your Machine

In order to contribute code, you'll need to write code on your local machine (computer), run a localhost app, run tests, and more.

Dependencies You Need to Setup

Here's what you'll need:

  1. Localhost app like Local by Flywheel, VVV, MAMP, WAMP, etc. Pick on that let's you change the PHP versions. Hint: Local is a great choice.
    • Beans versions less than 2 run on PHP 5.2 and tests are 5.6.
    • Beans version 2 will run on PHP 5.6.
  2. Git
    • Installed on your Mac or Windows machine
    • globally configured with a global .gitignore file - Mac | Windows
  3. A GitHub account.
  4. SSH setup on your local machine to your GitHub account - Mac | Windows.
  5. Composer globally installed on your Mac or Windows machine.
  6. For Beans v2 and up only: Node and npm installed on your Mac or Windows machine.
  7. Command line app such as Terminal on Mac, Window's built-in app, or the built-in terminal in PhpStorm.

Setting Up Beans Development Version

Once you above all of the global dependencies setup and ready to go, now you're ready to work on the Beans development version.

  1. Fork Beans to your GitHub account.
  2. On your local machine, create a development site with your localhost app. If using Local, here's a suggested setup:
    • Create a custom site named "beans-dev", which will be http://beansdev.test.
    • If working on Beans 1.x versions, here's the setup: - PHP Version 5.2.17 (for running the local site) and 5.6 when running tests (unless you have PHP 5.6 or higher globally installed on your Mac). - Web server - either apache or nginx. - MySQL version 5
    • If working on Beans >=2 versions, here's the setup: - PHP Version 5.6 - Web server - either apache or nginx. - MySQL version 5
  3. Clone Beans to your new local development site.
  4. In the wp-content/themes/tm-beans folder, do the following:
    • Type: composer install. Composer installs of the development dependencies.
    • For Beans v2 and up only, type: npm install to install of the node dependencies.
  5. Let's check that it's setup and ready for you:
    • Type: composer phpcs-tests. It should pass all of the PHPCS sniffer tests.
    • Type: composer test-unit. It should run and pass all of the Unit Tests.
    • If everything runs, you're ready for the next step.
  6. Sync to the Official Beans repository
  7. Work in a branch:
    • Working on a new feature or bug? Then create a branch. git checkout -b name-of-your-branch
    • Otherwise, type git checkout name-of-your-branch

Bam, you're now ready to start writing code and contributing. WooHoo!

Running Tests and Sniffers

Pull Requests

Make sure you checkout the Git Cheatsheet first.

  • Commits must start with a capital letter and end with a dot (unless it ends with a version number).
  • Commits must start with one of the following key words Added, Fixed, Updated, Improved, Modified or Removed.
  • Commits must be split into specific tasks and kept small so that other developers can easily see what it's about.
  • Tests need to all pass.
  • Code formatting and quality matter! Make sure that you run the sniffers to ensure your code is passes: vendor/bin/phpcs.