-
Notifications
You must be signed in to change notification settings - Fork 21
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
Support package names that differ from repository names #31
Conversation
src/Package_Command.php
Outdated
@@ -202,6 +202,12 @@ public function install( $args, $assoc_args ) { | |||
preg_match( '#([^:\/]+\/[^\/]+)\.git#', $package_name, $matches ); | |||
if ( ! empty( $matches[1] ) ) { | |||
$package_name = $matches[1]; | |||
$raw_content_url = 'https://raw.githubusercontent.com/' . $package_name . '/master/composer.json'; | |||
$composer_content_as_array = json_decode( $this->get_data_from_url( $raw_content_url ), true ); |
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.
Why not use WP_CLI\Utils\http_request()
?
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.
My bad, I was unaware of this function 😓 I'll make the changes
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.
Can you include a test for this change, please? Generally, tests are required for all pull requests.
@danielbachhuber I wanted to discuss this feature before adding tests, as you can see this fix only works for packages hosted on GitHub which restricts Git URLs hosted on different remote repositories like Bitbucket and GitLab. Do you have a better idea which I could implement? |
I'll defer to @schlessera |
@Sidsector9 There's already a function to get the package name: |
Repositories map package name to the repository location and require refers to package name.
What's done until now:
|
We need to add a test command that include the above problem to the |
@schlessera @Sidsector9 Should this land in the next release, or does it need more work? |
@danielbachhuber This is ready. |
GH#4232 Added check for package name
As of now, only packages hosted on GitHub is supported.
Related to issue 4232