Skip to content
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.

WITH_COMPOSER constant: Make a difference between "downloaded with composer" and "autoloaded with composer" #12

Open
ulk200 opened this issue May 31, 2016 · 3 comments

Comments

@ulk200
Copy link

ulk200 commented May 31, 2016

This is related to hoaproject/Ruler#86
I'm using the Hoa/Ruler library that i downloded with composer, but i'm using a third party autoloader. When hoa://Library/Ruler/Grammar.pp gets loaded the \Hoa\Protocol\Node\Library object calls its parent in the reach function because the WITH_COMPOSER contant is false. effectivly looking into directories in a camelcase name format.
But since i used composer to download the files, Grammar.pp is not found (my directories are not camelcase)
I solved this by forcing WITH_COMPOSER to true, this constant is based on wether the Composer\Autoload\ClassLoader class exists or not.
It may be preferable to make a distinction between "downloaded with composer" (which sets a specific directory structure) from the "autoloaded_with_composer" (which imply the class present at runtime).
Then hoa://Library/Ruler/Grammar.pp should rely on the "downloaded with composer" constant to call its parent or not.
Thank you.

@Hywan
Copy link
Member

Hywan commented May 31, 2016

Hello :-),

Is there a way to detect whether files/resources have been installed with Composer? I guess no 😢.

@Hywan Hywan changed the title WITH_COMPOSER constant : make a difference between "downloaded with composer" and "autoloaded with composer" WITH_COMPOSER constant: Make a difference between "downloaded with composer" and "autoloaded with composer" May 31, 2016
@ulk200
Copy link
Author

ulk200 commented May 31, 2016

Maybe you could test if the containing directory is named "Hoa" vs "hoa" ? I'm no composer expert but maybe you can tell composer (in the install phase) to generate an additionnal file ? Or to trigger a hook in the sources it just downloded ?

@Hywan
Copy link
Member

Hywan commented Jun 6, 2016

The issue is when you are working with a FS that is can insensitive, like the default one on Mac OS X. is_dir('Hoa') === is_dir('hoa') if one of them exists.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

2 participants