Bootstrap created unexpected folder structure #4
Comments
@Laykou - can you paste the content of the codecept binary please? Or just confirm if it uses some I don't have Windows and haven't tested it on that (yet) but have a feeling it is not over-writing the binary. |
Yes, I looked at it and this is my \vendor\bin\codecept
\vendor\bin\codecept.bat
They look like original bin files from codeception. I saw that the file Let me know if there is anything I can test for you on the windows. I tried it several times with the fresh composer update and always ended upt like thi.s |
Ok. Thanks, this confirms what I had suspected. Looks like I have some work to do on Windows. I am curious to know why your files are different from the ones in Codeception repo:
The Here's how the codecept file looks like on *NIX platforms (after being edited by the installer):
It won't work no matter how many times you will try since it just doesn't seem to autoload the same way on both platforms. Maybe if we identify why it has a different |
What line of script (what file) is responsible for copying the file into vendor\bin folder? I'm not that skilled with composer and how it works, but I learn quickly and I will do my best to find the solution :) |
@Laykou - in the case of Codeception, I believe this part of Composer's code: |
@jadb You got it! So that's how composer works: for windows it doesn't copy the file but only creates the proxy link to the real file: // From the composer/LibraryInstaller.php
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
file_put_contents($link, $this->generateUnixyProxyCode($binPath, $link));
} else {
symlink($relativeBin, $link)
}
// The proxy code function
protected function generateUnixyProxyCode($bin, $link)
{
$binPath = $this->filesystem->findShortestPath($link, $bin);
return "#!/usr/bin/env sh\n".
'SRC_DIR="`pwd`"'."\n".
'cd "`dirname "$0"`"'."\n".
'cd '.ProcessExecutor::escape(dirname($binPath))."\n".
'BIN_TARGET="`pwd`/'.basename($binPath)."\"\n".
'cd "$SRC_DIR"'."\n".
'"$BIN_TARGET" "$@"'."\n";
} Thats because on unix systems the symlink is created which is not available in the Windows. But then is the concept of ovewriting the file good? Because even in the Linux the original file |
While it's not what I would have preferred, overwriting is the only solution for now. Codeception, even though object-oriented, gives no other way but to either: a- overwrite the codecept binary For now, I am content with this solution as when using |
What if the |
@Laykou if that's the only way to resolve it for Windows, then yes. The original reasons I prefer modifying it instead of re-writing it was that maybe codeception upgrades, adds a new command but we don't need to customize that command, why have to update our code? If that makes any sense. So again, if it's the only solution, then it can be considered, otherwise, sticking to the way it is now is better IMO. Also, it's good to add, that this is a temporary solution. I do have plans for this library to have a |
What if the Closing as there is a pull request. |
The bootstrap command created this folder structure for me
which is different from what stated in the README file. Using Windows 7, PHP 5.6
My composer.json:
The text was updated successfully, but these errors were encountered: