-
Notifications
You must be signed in to change notification settings - Fork 61
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:
- Setup your machine.
- Interact with git and GitHub - See the Git Cheatsheet
- Run the tests and sniffers.
- Push Pull Requests (PR) to Beans for code review.
Ready? Let's go.
In order to contribute code, you'll need to write code on your local machine (computer), run a localhost app, run tests, and more.
Here's what you'll need:
- 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.
- Git
- A GitHub account.
- SSH setup on your local machine to your GitHub account - Mac | Windows.
- Composer globally installed on your Mac or Windows machine.
- For Beans v2 and up only: Node and npm installed on your Mac or Windows machine.
- Command line app such as Terminal on Mac, Window's built-in app, or the built-in terminal in PhpStorm.
Once you above all of the global dependencies setup and ready to go, now you're ready to work on the Beans development version.
- Fork Beans to your GitHub account.
- 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
- Clone Beans to your new local development site.
- 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.
- Type:
- 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.
- Type:
- Sync to the Official Beans repository
- 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
- Working on a new feature or bug? Then create a branch.
Bam, you're now ready to start writing code and contributing. WooHoo!
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
.