lslezak / build-rake

An extension for the atom-build package providing Rake support
MIT License
3 stars 7 forks source link

PATH problems on Windows #1

Closed andymeneely closed 8 years ago

andymeneely commented 8 years ago

Glad to see someone's trying to get rake working with the build package. I have not been able to get the build package to work on my system. When I use it with this package, I get this error:

Executing: rake build 
Unable to execute: rake
Make sure `cmd` and `cwd` exists and have correct access permissions.
Build finds binaries in these folders: C:\Ruby22\bin;C:\Users\andy\AppData\Local\atom\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Java\jdk1.7.0_03\bin;C:\Program Files (x86)\Windows Live\Shared;C:\Python34;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\Git\cmd;C:\Program Files (x86)\MiKTeX 2.9\miktex\bin\;C:\Program Files (x86)\Heroku\bin;C:\Program Files (x86)\git\cmd;C:\Program Files (x86)\QuickTime\QTSystem\;

The rake command is definitely on my path - in C:\Ruby22\bin.

lslezak commented 8 years ago

Thanks for the report. Unfortunately I do not have any experience with Ruby on Windows, I'll need your help with debugging.

Let's start with some questions:

lslezak commented 8 years ago

I just tried to check the content of the http://dl.bintray.com/oneclick/rubyinstaller/ruby-2.2.3-i386-mingw32.7z archive from http://rubyinstaller.org/downloads/. There is a rake.bat wrapper which runs the rake script via ruby.exe. (And no rake.exe is present.)

Does it help if you change rake to rake.bat here: https://github.com/lslezak/build-rake/blob/d709b5893b041bf99a28eaf74d729eed4576c25c/lib/build-rake.coffee#L29 ?

(On Linux the downloaded Atom packages are located at ~/.atom/packages I guess it is similar on Windows. Do not forget to restart Atom after editing the file...)

lslezak commented 8 years ago

Oh, there is one more place which runs rake: https://github.com/lslezak/build-rake/blob/d709b5893b041bf99a28eaf74d729eed4576c25c/lib/build-rake.coffee#L22. Please, adapt also this line...

andymeneely commented 8 years ago

Yes! That did the trick. Interestingly, I only had to change the line on line 29, but not 22. The rake -T always worked fine, but not the actually running of it. Changing line 22 to rake.bat -T didn't hurt though.

I don't know enough CoffeeScript to detect the OS version. I'll look into it and make a pull request if I get it working.

andymeneely commented 8 years ago

I got a fix. Pull request incoming...

andymeneely commented 8 years ago

Ok, I've got the pull request set up, but I can't get the tests to pass locally. I'm trying to get something like spyOn(process, 'platform').andReturn("osx") to get the test passing again before I add a Windows version of the test. That's where I'm stuck.

lslezak commented 8 years ago

Thanks for the feedback and the pull request!

I'll look at the failing test...

lslezak commented 8 years ago

It seems that mocking the process does not work properly. You need to use this trick:

Object.defineProperty process, 'platform', value: 'MockOS'

See more details here: http://stackoverflow.com/questions/30405397/how-do-you-mock-process-platform-in-jasmine-tests

andymeneely commented 8 years ago

That did it. I refactored the tests a bit and added a new one for Windows. Should be good to go.

lslezak commented 8 years ago

v.0.1.1 with the fix has been published at atom.io. Thank you a lot for the fix! :+1: