Test for OS name from inside ruby script

How do I test in my scripts for the OS type? So I can conditionally run
different code..?

thanks

···

--
Posted via http://www.ruby-forum.com/.

It's easiest with github.com/rdp/os

···

On 23.01.2010 07:56, Dale Ackerman wrote:

How do I test in my scripts for the OS type? So I can conditionally run
different code..?

--
Phillip Gawlowski

A quick google search led to this:
http://snippets.dzone.com/posts/show/6238 I imagine using RUBY_PLATFORM in
some manner is a good solution.

···

On Sat, Jan 23, 2010 at 1:56 AM, Dale Ackerman <dale8458@gmail.com> wrote:

How do I test in my scripts for the OS type? So I can conditionally run
different code..?

Jacob Mitchell wrote:

···

On Sat, Jan 23, 2010 at 1:56 AM, Dale Ackerman <dale8458@gmail.com> > wrote:

How do I test in my scripts for the OS type? So I can conditionally run
different code..?

A quick google search led to this:
http://snippets.dzone.com/posts/show/6238 I imagine using RUBY_PLATFORM
in
some manner is a good solution.

Thanks I got it going. I am using 'rbconfig'

--
Posted via http://www.ruby-forum.com/\.

No, do not use RUBY_PLATFORM. JRuby will return "java", for example:

If you want something built in use rbconfig.rb. Specifically,
Config::CONFIG['host_os']. Or you can use a 3rd party gem like sys-
uname or os.

Regards,

Dan

···

On Jan 23, 12:09 am, Jacob Mitchell <jacob.d.mitch...@gmail.com> wrote:

On Sat, Jan 23, 2010 at 1:56 AM, Dale Ackerman <dale8...@gmail.com> wrote:
> How do I test in my scripts for the OS type? So I can conditionally run
> different code..?

A quick google search led to this:http://snippets.dzone.com/posts/show/6238 I imagine using RUBY_PLATFORM in
some manner is a good solution.