richdynamix / magestead

The Vagrant Solution for Magento Developers
81 stars 29 forks source link

[Win10]New project can't write to auth.json file #64

Closed xewl closed 7 years ago

xewl commented 8 years ago

When generating a new project, there's a php-error in Magestead\Helper\Options.php on line 191 that's trying to write away the credentials to /.composer/auth.json via file_put_contents().

I think checking for non-existance & touch() would be in order in this step.

richdynamix commented 8 years ago

Would it be possible to dump the output of the error here?

There is no need to touch the file first before calling file_put_contents. If the filename does not exist, the file is created

xewl commented 8 years ago

Yes, I see, and that's what I thought at first too, but it still gave 2 errorlines on that function/line.

Also.. the generated puphpet file didn't create the foldersync either (looking at the config) when I did this, and so for some reason the whole vagrant file was not giving me access to the installed magento-directory after the second up. The link was gone.. So I kinda abandoned this generated vagrant due to that.

I will come back to this asap with screenshots a dump, when I'm able to re-do it. [Work, sleep, repeat :8ball: ]

xewl commented 8 years ago

Okay, a hint would be the first comment on the PHP-page...

"file_put_contents() fails if you try to put a file in a directory that doesn't exist." So, yes it creates the file, but not the folder it's written to; that one needs to exist and be writable already.

I guess the folder didn't exist. But I'll check for this quirk later.

richdynamix commented 8 years ago

What OS are you running on? The auth.json file is created in your COMPOSER_HOME directory. Which on Mac and most nix systems is /home/<user>/.composer There are some nix systems that use the XDG_CONFIG_HOME/composer however I am working on a fix for that.

Not sure I follow about the Vagrant file not giving access to the magento directory, its not the job of Vagrant to give folder access.

xewl commented 8 years ago

I was using Windows 10 in this case. Not my best choice of a dev platform either, but I needed a fast solution.

richdynamix commented 8 years ago

Unfortunately this is the problem. Magestead doesn't not work with Windows as I don't have a windows machine to test it. It also has the COMPOSER_HOME in a different location, obviously :)

I would like to add Windows support for magestead however the lack of Windows machines makes it impossible to test.

Hopefully someone can help add this functionality in - PR's are welcome :)