phpDocumentor icon indicating copy to clipboard operation
phpDocumentor copied to clipboard

Templates being installed into project root when installed via composer.

Open trq opened this issue 14 years ago • 7 comments

In #595 I have managed to fix the issue with the location of the vendor autoloader so that you can now install phpDocumentor via composer. This however now presents a new issue because the UnifiedAssetInstaller used to install templates is now installing these templates into the root of whatever project phpDocumentor has been pulled into.

I'm not sure what the side effects of this are ,but IMO, these templates should be installed into something like vendor/phpDocument/templates instead.

trq avatar Sep 11 '12 11:09 trq

Changing the UnifiedAssetInstaller would change the location of all templates and the code would have to be adjusted to look for the templates in the correct location. Because templates do not have a class or anything which can be picked up by the autoloader.

An unfortunate side-effect would be a rather large BC break since people who are using a custom template will no longer see those until they have reinstalled them.

An idea could be to install the templates in a data/templates folder at the root of the phpDocumentor installation (which in case of a composer install would be /vendor/phpDocumentor IIRC) and adjust phpDocumentor to take this into account. This will also introduce a BC break but that will not be noticeable since noone is using a direct install via composer due to the issues that you fixed :)

mvriel avatar Sep 16 '12 06:09 mvriel

@mvriel I believe this issue has been resolved. See #819

tommygnr avatar May 09 '13 07:05 tommygnr

Unfortunately the issue seems to persist because the installation of the UnifiedAssetLoader is executed prior to taht of the phpDocumentor package; when this happens the phpdocumentor folder in /vendor does not exist yet and are the templates still installed into the root of the project.

mvriel avatar Jul 21 '13 05:07 mvriel

At this moment I do not have a quick solution, I think it would be better if templates are always installed into /vendor/phpdocumentor/templates/[name] but that might cause issues with the base assets in /data which can no longer be found. Perhaps I should move all base assets to a common package and use that as basis? Or move all assets into a specific base template.

Need more time to think this through

mvriel avatar Jul 21 '13 09:07 mvriel

https://github.com/phpDocumentor/UnifiedAssetInstaller/pull/3 Should fix this

tommygnr avatar Aug 01 '13 05:08 tommygnr

I have been testing this using the release branch and it almost works; it would appear that composer doesnot install the templates the first time around .. it might be due to a missing directory as the vendor folder for phpdocumentor and its data/templates folder is not yet created?

When I call composer install a second time it installs the templates to the right folder.

Example composer.json:

{
    "name": "test/test",
    "require": {
        "phpdocumentor/phpdocumentor": "dev-release-2.0"
    },
    "minimum-stability": "dev"
}

mvriel avatar Aug 01 '13 21:08 mvriel

This has been fixed in release-2.0 and will be released tomorrow, mega kudos to @tommygnr for contributing this feature

mvriel avatar Aug 02 '13 11:08 mvriel