I am using rename, e.g.
"phpcs": {
"url": "https://github.com/squizlabs/PHP_CodeSniffer/releases/download/3.5.5/phpcs.phar",
"rename": true
}
This currently (1.4.1) fails due to two issues:
- The composer (1.10.5) tooling for symlinks require absolute paths (this may be a change on their side, I did not investigate). When using
rename the $filename is set to a plain name, phpcs in my example, when it should be /some/path/vendor/bin/phpcs.
- (After fixing 1)
process always downloads files with a .phar extension, so that symlinkOrCopy produces dangling symlinks for my example, e.g. phpcs -> ../tm/tooly-composer-script/bin/phpcs, when the downloaded file is forced to be ../tm/tooly-composer-script/bin/phpcs.phar.
My proposed patch:
diff -Naur tooly-composer-script/src/Script/Processor.php tooly-composer-script-patch/src/Script/Processor.php
--- tooly-composer-script/src/Script/Processor.php 2019-06-24 22:52:52.000000000 +0200
+++ tooly-composer-script-patch/src/Script/Processor.php 2020-05-05 17:38:06.726662222 +0200
@@ -101,10 +101,11 @@
$filename = $tool->getFilename();
if ($tool->renameToConfigKey()) {
- $filename = $tool->getName();
+ $filename = dirname($filename) . DIRECTORY_SEPARATOR . $tool->getName();
}
$composerDir = $this->configuration->getComposerBinDirectory();
$composerPath = $composerDir . DIRECTORY_SEPARATOR . basename($filename);
+ $filename = str_replace('.phar', '', $filename) . '.phar';
if (Platform::isWindows()) {
$this->helper->getFilesystem()->copyFile($filename, $composerPath);
I am using
rename, e.g.This currently (1.4.1) fails due to two issues:
renamethe$filenameis set to a plain name,phpcsin my example, when it should be/some/path/vendor/bin/phpcs.processalways downloads files with a.pharextension, so thatsymlinkOrCopyproduces dangling symlinks for my example, e.g.phpcs -> ../tm/tooly-composer-script/bin/phpcs, when the downloaded file is forced to be../tm/tooly-composer-script/bin/phpcs.phar.My proposed patch: