I’m writing a Rakefile that, at some point, starts Jetty. The Rakefile should be platform independant so I can use it in my windows and my mac. To start jetty there are two scripts provided: jetty.sh and jetty-cygwin.sh depending on the system you are on.
In a bash script I know that there is a OSTYPE that I can use to determine if i’m under win or under mac but it is unavailable under ENV in ruby. Is there any way of doing something similar in a Rakefile?
Thanks a lot in advance
Did you try
ENV['OS']? With Windows I get"Windows_NT"– sorry I can’t test it for Mac.There is also the constant
RUBY_PLATFORM( I get"i386-mingw32") – perhaps you can usethat.
Another idea, if the constants don’t work:
The command
veris defined in windows and returns the windows version. What happens when you call it on the Mac? You could try something like:Replace the
/Mac/with the result you have (even if it is an error message – if you get the error, it’s not Windows 😉 ).