-
Notifications
You must be signed in to change notification settings - Fork 6
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
Added WP Cli install task #5
Conversation
Hi, I've added them to a new branch
|
Hi! |
The reason why I create this PR is related to the possibility to check if WP cli is installed on remote server and, if not (with a fail() task or something similar), install it and the re-run the wp related task. This because I want create a deploy script that also a pure front-end designer can use to public a new website, without knowing nothing about droplet management. Utopia? Probable 😅 |
Oke, I get what you want to do. I'm just thinking about the possibilities, making it configurable but also not to complicated by adding a ton of configuration variables (because the
utils/wp-cli.php function getWPCLIBinary() {
if (commandExist('wp')) {
return locateBinaryPath('wp');
}
$installPath = '{{deploy_path}}/.dep';
$binaryFile = 'wp-cli.phar';
if (test("[ -f $installPath/$binaryFile ]")) {
return "{{bin/php}} $installPath/$binaryFile";
}
return false;
} set.php set('bin/wp', function() {
if($path = getWPCLIBinary()) {
return $path;
}
return installWPCLI('/usr/local/bin', 'wp', true);
} For reference, here's how deployphp handles installing composer (that's how I tried to do it in my last commit): https://github.com/deployphp/deployer/blob/da432e01399489a896e880e9469c01ffad5491e6/recipe/deploy/vendors.php I'm leaning towards option 3, which makes it easier to overwrite |
For solution 2, it wouldn't be a problem to advise a frontend dev to follow a specific task list but, I agree with you that solution 3 is the most reusable and if someone wants to create a task for wp installation they can use the getWPCLIBinary function. |
Please have a look at 282f9c3 By default You can easily overwrite this configuration for your boilerplates etc. to install it to a global file like so: set('bin/wp', function() {
if($path = getWPCLIBinary()) {
return $path;
}
return installWPCLI('/usr/local/bin', 'wp', true);
} You can also tell your developers to run I think that should handle all cases, what do you think? Could you please try it out :) |
Sorry for delay, it was a busy week! I think that sounds good! Reusable and functional! Really a great job! |
Closed for GH-6 and merged in v1.4.0 Thanks for your contribution, input and feedback 👍 |
Usefull to not switch from local machine and remote only for install wp-cli.