Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add WP-CLI recipe #3533

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions contrib/wp-cli.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
/*
## Configuration

- `bin/wp` *(optional)*: set WP-CLI binary, automatically detected otherwise.

## Usage

```php
task('deploy:wp-core-download', function() {
run('cd {{release_or_current_path}} && {{bin/wp}} core download');
});
```
*/
namespace Deployer;

set('bin/wp', function () {
if (test('[ -f {{release_or_current_path}}/vendor/wp-cli/wp-cli/php/boot-fs.php ]')) {
return '{{bin/php}} {{release_or_current_path}}/vendor/wp-cli/wp-cli/php/boot-fs.php';
}

if (test('[ -f {{deploy_path}}/.dep/wp-cli.phar ]')) {
return '{{bin/php}} {{deploy_path}}/.dep/wp-cli.phar';
}

if (commandExist('wp')) {
return '{{bin/php}} ' . which('wp');
}

warning("WP-CLI binary wasn't found. Installing latest WP-CLI to \"{{deploy_path}}/.dep/wp-cli.phar\".");
run('cd {{deploy_path}} && curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar');
run('mv {{deploy_path}}/wp-cli.phar {{deploy_path}}/.dep/wp-cli.phar');
return '{{bin/php}} {{deploy_path}}/.dep/wp-cli.phar';
});
1 change: 1 addition & 0 deletions docs/contrib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@
* [Telegram Recipe](/docs/contrib/telegram.md)
* [Webpack_encore Recipe](/docs/contrib/webpack_encore.md)
* [Workplace Recipe](/docs/contrib/workplace.md)
* [Wp-cli Recipe](/docs/contrib/wp-cli.md)
* [Yammer Recipe](/docs/contrib/yammer.md)
* [Yarn Recipe](/docs/contrib/yarn.md)
40 changes: 40 additions & 0 deletions docs/contrib/wp-cli.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!-- DO NOT EDIT THIS FILE! -->
<!-- Instead edit contrib/wp-cli.php -->
<!-- Then run bin/docgen -->

# Wp-cli Recipe

```php
require 'contrib/wp-cli.php';
```

[Source](/contrib/wp-cli.php)



## Configuration

- `bin/wp` *(optional)*: set WP-CLI binary, automatically detected otherwise.

## Usage

```php
task('deploy:wp-core-download', function() {
run('cd {{release_or_current_path}} && {{bin/wp}} core download');
});
```


## Configuration
### bin/wp
[Source](https://github.com/deployphp/deployer/blob/master/contrib/wp-cli.php#L17)


:::info Autogenerated
The value of this configuration is autogenerated on access.
:::