-
Notifications
You must be signed in to change notification settings - Fork 452
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
PHP beautifier does not use global php-cs-fixer #390
Comments
and
The command there is for Linux / Mac and will not work on Windows. Windows does not handle Note: I would recommend creating an issue for the PHP-CS-Fixer team over at https://github.com/FriendsOfPHP/PHP-CS-Fixer for Windows support. Their documentation is not clear for Windows users. I was able to get everything installed and working for Atom Beautify on AppVeyor's Windows CI with Lines 92 to 101 in 78b6d55
The
From http://stackoverflow.com/a/9542689/2578205 and in your case, it could likely be that
Notice above that I replaced I am not a Windows users, nor do I recommend Windows for software development. Thus use the above at your own risk and you will have to do any debugging on your own. You can see https://github.com/Glavin001/atom-beautify/blob/master/appveyor.yml#L43 for how I have installed and setup Windows on AppVeyor for Atom Beautify Windows support.
and
and
You did not set the executable path. You set it to
This is correct. This is configured correctly, and it now looks like Atom Beautify is working correctly as expected. Unfortunately, on Windows and with PHP-CS-Fixer, the global does not always get recognized properly. Windows + PHP has been causing a lot of problems. I will be releasing some fixes for Windows with the issue #375. Please follow that issue to see Windows updates. I hope that with the improvements I have made for #375 that this may actually work for you, globally and automatically, like it does for Linux and Mac users. Thanks for your patience. |
Oh, my bad. I was just referring to the general concept. Unfortunatly i am limited to using windows, since its the default for me at the office. At home i am also using a linux based system. Anyway thanks for your effort and i'll check it at work tomorrow. If it doesn't work i might look at writing a fix, if i find the time. |
Not a problem. Atom Beautify should properly use the PATH environment variables now on Windows as well ( #375 was just published ). Any executables you need should be installed and then configured in your PATH to work. If that does not work, then we have a problem -- although this is unlikely. I think you should be good from now on. 👍 |
I just updated the winows machine and unfortunatly the problem persists. Whats causing it is that php-cs-fixer is not called directly but as an argument to php. E.g:
I can execute it directly from command line like this:
I tried fixing it myself within php-cs-fixer.coffee but was not successful thus far, since i am not that familiar with coffeescript & nodejs. |
It shows
Windows requires the |
Well i have successfully executed the beautify with the unix version of |
I would prefer to get rid of the /cc @guillempascual could you give us some insight as to why you found that |
By using node-which I believe I am able to get rid of the Update: I was able to get the absolute path to |
By using [node-which](https://github.com/isaacs/node-which) I believe I am able to get rid of the `php` command running `php-cs-fixer` as an argument. `which` will find the `php-cs-fixer` program by looking through the `PATH` environment variable listed directories. This will resolve `php-cs-fixer` to an absolute path to the executable and that will be used to run the command. This dramatically cleans up the `PHP-CS-Fixer beautifier` code and specs, too! Doing some Windows tests now.
Published an improvement to PHP-CS-Fixer beautifier for Windows to v0.28.4 release. Hopefully that helps. It still uses |
I really want to focus on improving the installation experience for users. I have created a new Issue, #1687, to target this problem. Please provide your feedback! Thanks in advance. |
Hello there,
thanks first of all for your package.
I have a problem when using it, to reformat php code.
Atom is running on a Win7 maschine, with a global installation of php-cs-fixer.
It was installed according to this section in on their github page
Globally (Composer)
To install PHP-CS-Fixer, install Composer and issue the following command:
$ ./composer.phar global require fabpot/php-cs-fixer
Then, make sure you have ~/.composer/vendor/bin in your PATH, and you're good to go:
export PATH="$PATH:$HOME/.composer/vendor/bin"
If i set the executable path in your package, it still gets called with php.
2015-06-08T16:39:23.237Z - debug: [C:\Users.atom\packages\atom-beautify\src\beautifiers\beautifier.coffee] php-cs-fixer indent_size=4, indent_char= , indent_with_tabs=false, cs_fixer_path=php-cs-fixer, fixers=, level=, indent_style=space, end_of_line=lf, insert_final_newline=true, trim_trailing_whitespace=true, tab_width=4 2015-06-08T16:39:23.239Z - debug: [C:\Users.atom\packages\atom-beautify\src\beautifiers\beautifier.coffee] tempFile temp null path=C:\Users\AppData\Local\Temp\temp11558-716-1ndwvai, fd=0 2015-06-08T16:39:23.242Z - debug: [C:\Users.atom\packages\atom-beautify\src\beautifiers\beautifier.coffee] spawn php 0=php-cs-fixer, 1=fix, 2=C:\Users\AppData\Local\Temp\temp11558-716-1ndwvai 2015-06-08T16:39:23.286Z - debug: [C:\Users.atom\packages\atom-beautify\src\beautifiers\beautifier.coffee] spawn done 1 Could not open input file: php-cs-fixer
It does however work, if i set the full path. E.g:
C:\Users\AppData\Roaming\Composer\vendor\fabpot\php-cs-fixer\php-cs-fixer
Regards
The text was updated successfully, but these errors were encountered: