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
A command for browsing, installing, updating and deleting community commands #602
Conversation
Grab bag of pieces to finish up:
|
WP isn't needed for package management.
Another for the hit list:
@scribu Should installing a package also handle any dependencies for the package? How far down the rabbit hole do we want to go? |
Yes; it should do everything that |
Maybe it would be best for the first iteration to have a hybrid approach: offload everything we can to the |
As a general guideline, it's more important to re-use the same logic that Composer uses; it doesn't matter at this point if the output it generates doesn't match the style of normal WP-CLI commands. |
/** | ||
* Pluck elements from a list, a la wp_list_pluck() | ||
*/ | ||
private function list_pluck( $list, $element ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or we could do a polyfill for array_column().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, there's even a Composer package: https://github.com/ramsey/array_column :)
…se it in the installer.
… if the package is listed in our Packagist. All of the commands listed in Packagist right now don't have `wp-cli` as a requirement, so that check is pointless.
I decided against calling
With that being said, being able to leverage the Composer PHP library in the background is quite nice. We get a fair amount for free, like support for multiple installation mechanisms. Another task still needing to be done:
@scribu Can you give this a bang and checklist any other tasks you'd like to see completed before MVP? The last open piece in my head is how we handle Composer's |
|
||
/** | ||
* Check whether a package is a WP-CLI community package based | ||
* on membership in our Packagist repo. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: it's not a Packagist repo; it's a Satis repo. The official®™ name is "package index".
Yeah, I'll take it for a spin soon. |
// @todo Is there a better way of getting the WP-CLI repo? | ||
// ... there doesn't seem to be a method for getting any unique ID | ||
// and right now we're assuming WP-CLI is the first repo listed | ||
$wp_cli_repo = array_shift( $repos ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The WP-CLI package index URL should be under the wp-cli
key, if you use the following command to add it:
composer config repositories.wp-cli composer http://wp-cli.org/package-index/
The following series of steps fails:
We need some Behat tests for this. |
I think "community packages" is better because a package can contain anything, not just commands. For example, you might write a package that only calls |
hardcode pacakge index URL for now. also, remove set_composer_json_path() helper
Erm... yeah, this needs a lot more work than I thought. But, I think we're getting there. |
:) Getting somewhere at least. Hopefully it's where we want to go. I'll have some time on Sunday to work on this. |
If I'm on a development branch of WP-CLI and I try to install a package manually, I get this:
That's because the server-command package has Not sure what to do about it right now; I just know that it's a problem. |
The easiest solution would be to remove the wp-cli/wp-cli requirement from community packages. In
|
@@ -12,6 +12,7 @@ | |||
"wp-cli/php-cli-tools": "0.9.3", | |||
"mustache/mustache": "~2.4", | |||
"rhumsaa/array_column": "~1.1", | |||
"composer/composer": "dev-master" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing a trailing comma here.
Doesn't need PHPUnit and Behat installed as packages
Related: #665 |
When WP-CLI is installed as a phar archive, we can't use the bundled So, I think we should resolve #698, so that one could do |
Originally: #424
Continuation of https://github.com/danielbachhuber/wp-cli-package-command
Let's get this shipped.