Add extension .phar to installed tools
PHPStorm don't understand content of PHAR file and cannot autocomplete when tool installed via link and without extension. Currently, we have to do it manually. So, this update should help to solve this issue.
It's actually very much intentional we drop the extension. And one of the reaons is exactly that PHPStorm does NOT "see" them. Because you exactly do NOT want to have autocomplete for code that just happens to be used by your tools.
I see that there is at least one valid edge case: PHPUnit, which happens to be a tool as well as a framework for which you'd want autocomplete when writing tests. But then again, you do NOT want auto complete for all of PHPUnit but only the relevant framework components.
Thanks for providing this PR though anyway. I have to think about this change. It feels like the wrong solution to the problem.
On my point of view, it is useful not only for PHPUnit, but for all scripts which works with configs in php-files.
I'm still not fully convinced but am considering to add this, as you made it a configurable thing.
Did you test this on windows? Because adding .phar to a .bat file is not going to work ;)
Second question: Is the -e-Handling reflected in the data stored in the phive.xml / .phive/phars.xml respectively?
This config affects only new installs case all aspects of installation of packages added before handled by .phive/phars.xml
I don't quite understand why you talk about .bat files case phive should install entire phar version of scripts. Could you clarify what I am missing?
On a unix'ish OS, we use symlinks per default to map a shared phar from the location we store them into the respective project. We can, of course, easily control the target name in the project as your patch suggests.
On Windows, a .phar is not executable as windows does not have the concept of executable attributes. Thus, for windows, we deploy a .bat-file as a wrapper. (See https://github.com/phar-io/phive/blob/master/src/services/phar/WindowsPharInstaller.php and https://github.com/phar-io/phive/blob/master/conf/pharBat.template, respectively).
Your implementation seems to be unaware of this and thus would potentially only work when the phar is copied along, e.g. wenn --copy is specified.
And I'm not sure if the changed name is reflected in the phive.xml / .phive/phars.xml file when -e was used, given the location you apply the configuration option. But I haven't looked into that.
Thank you, @theseer. Let me check and make necessary updates.
Thank you @Aeliot-Tm : the configuration would help not only with PHPUnit but also for php-cs-fixer :)
The solution I currently apply is:
- install the tool
- alter
phive.xmlto have the.pharextension for that tool - run again phive install (which will copy the tool with the expected .phar extension)
- remove the tool installed in step 1
note: I use --copy and I work on Linux
https://github.com/phar-io/phive/issues/116 https://github.com/phar-io/phive/issues/405