-
-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Root directories can not be deleted #43
Comments
I think I've seen that when running Mozart from the vendor/bin directory without setting the current working directory to be the project root. In my case through a PhpStorm run configuration on MacOS. I can't reproduce now and that doesn't sound like your problem, anyway. Filesystem.php:248 is the
So Util::normalizePath must be returning an empty string. I've set a breakpoint in PhpStorm and I'm not able to reproduce. Try create a file
Then My output is:
The other suspicion I had (but doesn't really make sense after reading the code) is that Windows is actually trying to delete a root dir so you should just change |
@BrianHenryIE Thank you very much for the detailed reply. So I added the script and ran it and I get the following:
Which Looked Identical to yours. SO I tweaked the dep_directory to
Im pretty sure its something Windows based but cant for the life of me figure out why its doing it |
Post your full composer.json, the smallest possible to reproduce it, and I'll try again. |
@BrianHenryIE I figured out the error, I was missing
This is now my Composer file:
Any Idea? |
@BrianHenryIE An Update to what I posted, Looks like running Update: Found that Issue too. I have a specific Composer file called
Looks Like Mozart is Expecting a Im Still seeing this error as it appears to be removing the vendor folder (when using
|
Are you sure you're on the latest beta? I think unless you set I did do some testing the other day (the day before your last post) but I still wasn't able to reproduce your issue. Again, I'm on MacOS. Although maybe this will mostly boil down to |
Thank you @BrianHenryIE , I have added the "minimum-stability": "dev" to composer so that the latest version is updated. I THINk you right that something is up with However, Part of diagnosing that issue I THINK I found the Original issue when using Mozart that returned the following:
With a lot of diagnostic work, I figured out the issue. Basically you HAVE to use New Issue After figuring out you can only use When running I kept facing this issue:
Regardless if I set So I thought MAYBE if I set up the packages I wanted to replaCE WITH Mozart outside of vendor, perhaps that would resolve it. One of the Packages we want to resolve is Pimple, SO I added that into a new folder called
Again, when running, even though So that I wasnt going mad, I ran this on the Gitlab server (Is uses this Docker Image) too and could re-create the same output. The One Thing I did notice (mainly from my local setup) is the path as it starts off Windows Based. Would this be the issue why everything gets removed? This is now my
Thank you for the amazing help so far, at least i feel we are getting somewhere! |
Hey @BrianHenryIE Looks like I have jit a wall with Mozart. I just cant get it going at all. I have tried many ways to do this including keeping the Mozart install Separate from the Other Vendor files as they keep on getting removed (even though Is it the fact I am on Windows and I cant set it up in that environment? This is now my
Keeping it away from the main composer file so it doesn't remove itself (Mozart kept on disappearing if ran inside the vendor folder). When I run this, this is the error I get:
I have tried the latest beta version, Master and an older version. Nothing. Im missing something simple im sure but it just doesnt run. |
@BrianHenryIE So I have dug deeper in this issue and I managed to get one of the members of the team (who has a Mac) to try my exact same setup and you know what? Worked first time without issues for him. So there must be a bug somewhere for a Windows setup like im using that it basically ignores a lot of stuff including not to delete vendor etc. Do you mind me digging in the code? see if I can notice something that may help? |
I made a patch that replaces all
|
@BrianHenryIE Thank you for the patch but...Didnt work :/ So Ive been trying to diagnose what on earth is going on under the windows directory and so far I have gone to
Im going to try and drill down see if I can find why its deleting before it gets to this point but something odd is happening with the paths |
@BrianHenryIE To add to my testing etc. today, This fix you made worked for our Gitlab Ci service running an Alpine Linux Docker image. However, I just cant get it to work for Windows at all (Via Windows Git Bash). At least I can carry on via gitlab for now. |
So By "give it a go" you shouldn't have to change anything, |
@BrianHenryIE Yes! thats it, it worked :) I tried going through it myself and I found a few but didnt get there but that update has done the job. Phew! thank you so much for that! |
When will this be in the release @BrianHenryIE oir is it just keep an eye out? Also, I wondered if you have anything special you used to get aws/aws-sdk-php working (if you have tried). After going through Mozart, it just doesnt appear to work :/ I expect its the way AWS is setup :) |
I'm not a maintainer of this project, just I use it a lot. Half the problems I've helped with are ones I've already dealt with myself, but then have taken the time to PR. Others are ones that have been easier for me to figure because I've read the code more than most, and helping is fun. So it's up to @coenjacobs 's timeline when #61 gets merged. It's a relatively easy to read PR but there's a couple of spots open to improvement. And no tests (I don't even know how to write cross-platform tests). Regards AWS, I haven't used it in any project myself (I have one AWS SNS project but it doesn't need the SDK), but on a quick glance, I see there is a |
Thank you for the reply @BrianHenryIE and thought you were one of the main people on the project as you have been very helpful :) So yes, #61 has solved this issues problem and shall wait on @coenjacobs but not the end of the world as Im pulling in the changes anyway which is cool. With AWS yes, I noticed that too when digging around and seems to be a no go at the moment. I think I will raise another issue, see if we can dig deeper and look at whats going on |
@darthvader666uk You are correct, @BrianHenryIE is an amazing help to this project. I'll have a look over the next few days, as a couple PRs and issues are requiring my attention. I'll see to releasing everything in the next beta of 0.6.0 and get that into a stable release as soon as I deem things to be stable enough. Really glad this got sorted! |
@coenjacobs & @BrianHenryIE So Oddly, after the Patch got merged, I had this issue again:
With it being Windows and how Paths can be funky, I have done alot of digging and I think I finally come up with a solution (working locally). In src\Console\Commands\Compose.php on like 38 there is I had no issues at all. I think the combo with the updates from DIRECTORY_SEPARATOR seemed to have resolve almost all issues and I think that was the final piece. Problem is, as its my Fork I got no way of testing it on out CI on Gitlab. I can make a Pull request but I expect you would want to check first etc. What are your thoughts? Edit: I did a pull request but this can alway be removed if your not happy but Im doing full test as we speak. |
I'm pretty sure the test suite won't pass with that change because I need to set the current working directory to a temporary directory to execute Anyway, this issue looks to be the same as #90, where I posted some code in that issue to replace in public function moveFile(Package $package, $autoloader, $file, $path = '')
{
/**
* For Windows & Unix file paths' compatibility.
*
* * Removes duplicate `\` and `/`.
* * Trims them from each end.
* * Replaces them with the OS agnostic DIRECTORY_SEPARATOR.
*
* @param string $path A full or partial filepath.
*
* @return string
*/
$clean = function ($path) {
return trim(preg_replace('/[\/\\\\]+/', DIRECTORY_SEPARATOR, $path), DIRECTORY_SEPARATOR);
};
// The relative path to the file from the project root.
$sourceFilePath = $clean(str_replace($this->workingDir, '', $file->getPathname()));
$namespacePath = $clean($package->config->name);
if ($autoloader instanceof NamespaceAutoloader) {
$namespacePath = $clean($autoloader->getNamespacePath());
// TODO: $path should come from the NameSpaceAutoloader object.
$packageVendorPath = 'vendor' . DIRECTORY_SEPARATOR . $namespacePath
. DIRECTORY_SEPARATOR . $clean($path);
$mozartDepPath = $clean($this->config->dep_directory) . DIRECTORY_SEPARATOR . $namespacePath;
$targetFilePath = str_ireplace($packageVendorPath, $mozartDepPath, $sourceFilePath);
} else {
$classmapDirectory = $clean($this->config->classmap_directory);
$packageVendorPath = 'vendor' . DIRECTORY_SEPARATOR . $namespacePath;
$mozartClassesPath = $classmapDirectory . DIRECTORY_SEPARATOR . $namespacePath;
$targetFilePath = str_ireplace($packageVendorPath, $mozartClassesPath, $sourceFilePath);
}
$this->filesystem->copy($sourceFilePath, $targetFilePath);
return $targetFilePath;
} There's still some |
The following appears correct:
The |
Hi,
Wondered if you could help?
Currently installing Mozart to our Project but every time I run
vendor/bin/mozart compose
I keep getting the following:Im using WIndiows with VSCode and Git Bash. This is the composer file:
I couldn't find much on google. Any help is appreciated.
The text was updated successfully, but these errors were encountered: