-
-
Notifications
You must be signed in to change notification settings - Fork 412
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
Allows for custom name that is different from package name? #21
Comments
I personally feel that naming a package without a framework identifier is better. I had the same issue with one of my packages, cakeftp and I ended up using the name With #10, you could do this when you install: {
"require": {
"uzyn/cakephp-aws-datasource": "*"
},
"extra": {
"installer-paths": {
"Plugin/AwsDatasources/": ["uzyn/cakephp-aws-datasource"]
}
}
} I know there are a lot of existing cake packages that prepend cakephp- or cake. Some have even more explicit package names but need to install to a different name (https://github.com/nodesagency/Platform-API-plugin). So you might be the first of many to file an issue about this. It wouldn't hurt to propose an additional extra field for overriding the package name and get a response. I'm for it. |
I've just submitted a pull request. I still feel that having a framework identifier makes some sense, it makes searching on Packagist clearer. Also, I feel that sometimes a user may not always have the full liberty to name a package what he/she wants. For example, I developed an Opauth ( |
D'oh. Missed this discussion before answering in #22. Sorry for being ignorant about CakePHP, but what is the effective difference between having something installed as plugins/lala and plugins/cakephp-lala? |
@Seldaek For the case of CakePHP, it would break the CakePHP convention and plugin path discovery. There are then more steps required for plugin user to specify custom paths for a plugin that it would makes no sense to use this installer anymore rather than just asking users to I'm fairly sure this is not unique to CakePHP, besides also breaking PSR-0. |
As @Seldaek pointed out at #22, yes one can do it via #20 's
|
My ideal solution would be this:
Ultimately the consumer has the option to control the install path with #20 solves this naming issue but I think it's cumbersome to ask package authors to instruct consumers to include the |
@shama ah well, I guess you are right. But I would rather not have package.extra.installer-path be a full path, I'd rather have just a installer-name one that just overrides the To sum up I think this whole thing is a mess and I'd rather not have it, but if you really must I think I'll have to trust you on the requirements. From where I stand, the fact that this is needed just highlights a problem in cakephp - path discovery is a common pattern, but it is a really annoying one. |
@Seldaek CakePHP, as well as many other frameworks were around before autoloading. Each had to develop their own path convention. I see this issue and project as embracing other conventions rather than trying to force a Composer convention. You could call it a CakePHP or framework X problem if Composer existed when these decisions were made. Unfortunately we all weren't so lucky. ;) I understand why you don't want these changes. It is pretty much impossible to remove the feature once implemented and adopted in the wild. So maybe a better route would be for me to fork and implement these edge case issues. Then consider introducing them to composer/installers when their necessity has been proven. |
Here is my decision on this... Package authors are already choosing to use composer/installers and setting the type to determine the install path. They should be allowed to choose their own install path for their package as well. This will fix this name issue without needing another extra option. If a consumer doesn't like it or if a conflict occurs they can simply override it with their own installer-paths extra. After much thought and considering what installers currently allows, I don't foresee any problems with this approach and it seems to be the best and simplest solution. Standard Author Config - installs to {
"name": "vendor/name",
"type": "cakephp-plugin",
"require": {
"composer/installers": "*"
}
} Overridden Author Config - installs to {
"name": "vendor/name",
"type": "cakephp-plugin",
"require": {
"composer/installers": "*"
},
"extra": {
"installer-paths": {
"Plugin/MyCustomName/": ["vendor/name"]
}
}
} EDIT: I would like to keep the interface the same but of course would not allow a package author to override another package author. The check for this config would only look for a path set for their own package. Consumer Config - installs to {
"extra": {
"installer-paths": {
"app/Plugin/ConsumerName/": ["vendor/name"]
}
}
} This should handle the extent of install path selection in composer/installers. @uzyn If you would like to send a PR for this let me know. I would appreciate it. |
@shama Just to check that I'm not missing anything. The difference between this and #20 is the Consumer Config part? I generally like the idea of allowing consumer to overwrite the install paths. That's a great decision, @shama. However, allow me to still make a last case with why I still feel the need of an One of the main points, I feel, for By having users, especially authors, abusing
By having a lighter-weigh Just thought I would make a last case for |
#20 is the consumer config and is currently implemented. I am saying we should implement Overridden Author Config option above as a solution to this name issue. I think it is fair to say
This would also be useful for frameworks implementing their own packagist.org (as CakePHP plans to do cakephp/plugins.cakephp.org#53). Default install locations can be set to help the existing packages migrate to composer. |
What if the name permitted a regex with named parameters? e.g.,
|
@robocoder I think the regex patterns are very interesting but I'll wait until more people find managing their paths a problem before implementing into installers. Thanks! |
I'm not sure if this is related to #10, but I feel it is different.
Currently installers determine that the name for a package (for example, the name for a CakePHP plugin) to simply be
$prettyName
. I feel that that may not always be the best name for a package.For example, I have a this Git repo: https://github.com/uzyn/cakephp-aws-datasources. Its
name
atcomposer.json
isuzyn/cakephp-aws-datasources
.However, when it is installed as a CakePHP plugin, I would prefer it to be installed to
Plugin/AwsDatasources
instead ofPlugin/CakephpAwsDatasources
.I could name my package
uzyn/aws-datasources
, but that would make it less obvious that it is a CakePHP-related package on both Packagist and GitHub.The text was updated successfully, but these errors were encountered: