Are you going to contributing into the WP-CLI? Ah, alright. This article will help you and will save your time too, Before going below I’m assuming you cloned the WP-CLI repository to your local system or if you don’t know how to clone ( for a beginner ) later on in this article you will get to know about this too.
Well, once you had done your work or changes on any of WP-CLI repository. Wait! before sending the Pull Request to WP-CLI you must have to verify that your codes run works properly or not. However, WP-CLI comes in PHAR comparison. So, you just can’t replace the files inside it and it’s not like other repositories that you can run and test it directly.
To run the changes you had made so far, you can follow this steps:
Composer is a dependency manager for PHP. Composer will manage the dependencies you require on a project by project basis. This means that Composer will pull in all the required libraries, dependencies and manage them all in one place.
You can download and setup composer from https://getcomposer.org/ I don’t think you will get stuck while installing it 😉
Or you can install it from Terminal.
$ curl -s https://getcomposer.org/installer | php $ sudo mv composer.phar /usr/local/bin/composer
What is hub? hub is a command line tool that wraps
git in order to extend it with extra features and commands that make working with GitHub easier. Know more about Hub form https://github.com/github/hub
Install in Mac
To install the hub in Mac OS you would have to run this below command.
$ brew install hub
Install In windows:
Download the binary release from the https://github.com/github/hub/releases for eg. hub 2.2.9 for Windows 32-bit and just run the install batch script.
In windows, you can download the Binary release from https://github.com/github/hub/releases or you can just download the right release of the hub for your Win OS.
Install in Ubuntu:
You can either download the release from the https://github.com/github/hub/releases or you can install the brew in your ubuntu system which will allow you to install hub with a single command.
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install)"
Then run this command:
$ brew install hub
If you find any difficulty while installing hub please comment below, would <3 to help.
To check whether Hub is installed properly on your system, Simply check the version of Hub by below command.
$ hub --version git version 2.12.2 hub version 2.2.9
Clone WP-CLI repo into your local machine.
If you have already cloned the WP-CLI repository, then just move to the repository root.
$ git clone https://github.com/wp-cli/wp-cli.git wp-cli $ cd wp-cli
Fork the repo through hub
When you run the below command you will be asked to enter your GitHub credentials.
$ hub fork Updating wp-cli remote: Counting objects: 1, done. remote: Total 1 (delta 0), reused 1 (delta 0), pack-reused 0 Unpacking objects: 100% (1/1), done.
Install all Composer dependencies
Once the repository has been forked, The below command will install all dependencies repositories.
$ composer install --prefer-source
Verify the installations
To see everything’s working fine, simply run the command ‘bin/wp –info’
$ bin/wp --info PHP binary: /usr/bin/php PHP binary: /usr/bin/php PHP version: 7.0.15-0ubuntu0.16.04.4 php.ini used: /etc/php/7.0/cli/php.ini WP-CLI root dir: /var/www/wp-cli WP-CLI vendor dir: /var/www/wp-cli/vendor WP_CLI phar path: WP-CLI packages dir: WP-CLI global config: WP-CLI project config: WP-CLI version: 1.4.0-alpha
That’s it now you can make any changes in any of the repositories and run the command 🙂
But wait, there is some other point which you should follow
Follow Contributions Guidelines
Apart from the testing of the codes, you should always follow the guidelines mentioned in https://make.wordpress.org/cli/handbook/contributing/ following guideline will increase your chances of your PR to be merged 🙂
Be a part of the conversation
All the conversations regarding the WP-CLI happen inside the #cli channel in slack.
Keep connected with changes.
There’s also the #cli-firehose channel, where you can see a log of all the changes to the WP-CLI’s GitHub repositories.
For new contributors
Are you new to wp-cli? if so, then the link mentioned below would be really helpful for you, all the issue marked as easy and simple bug would be listed here.
Thank you for reading to the end, I hope it was helpful for you.
If you have any query or concern regarding these step or need any further detail please ask below.