Smart(er) platform detection

Please see sys-uname.

Regards,

Dan

···

-----Original Message-----
From: Matt Mower [mailto:matt.mower@gmail.com]
Sent: Wednesday, June 29, 2005 4:16 AM
To: ruby-talk ML
Subject: Smart(er) platform detection

Hi folks,

I recently got bitten by some code which uses an idiom like:

if RUBY_PLATFORM =~ /win/i
  # windows stuff here
end

which is fine until you try it on a machine (like my shiny new
PowerBook) whose platform string is:

  powerpc-darwin-8.1.0

I looked around and couldn't find a systematic solution to
getting useful information from RUBY_PLATFORM so I quickly
hacked something together which you can find described at:

Hi Dan,

Please see sys-uname.

Thanks for the pointer. I did actually look for a library by you
because someone mentioned in IRC that you'd done something along these
lines.

It seems like this provides a lot better information than I can get
from RUBY_PLATFORM but is in the form of a C extension which doesn't
suit me. It might be exactly right for some other folks though.

Regards,

Matt

···

On 6/29/05, Berger, Daniel <Daniel.Berger@qwest.com> wrote:

--
Matt Mower :: http://matt.blogs.it/

Matt Mower wrote:

Hi Dan,

Please see sys-uname.

Thanks for the pointer. I did actually look for a library by you
because someone mentioned in IRC that you'd done something along these
lines.

It seems like this provides a lot better information than I can get
from RUBY_PLATFORM but is in the form of a C extension which doesn't
suit me. It might be exactly right for some other folks though.

Regards,

Matt

If it helps soothe your mind, the Win32 version is pure Ruby. :slight_smile:

Regards,

Dan

PS - I updated the description of sys-uname on the RAA, so hopefully folks will discover it a little easier in the future.

···

On 6/29/05, Berger, Daniel <Daniel.Berger@qwest.com> wrote:

But that fact doesn't help the VMS port, since the Win32 version depends
on OLE.

Ben

···

On Wed, 2005-06-29 at 23:05 +0900, Daniel Berger wrote:

If it helps soothe your mind, the Win32 version is pure Ruby. :slight_smile:

> It seems like this provides a lot better information than I can get
> from RUBY_PLATFORM but is in the form of a C extension which doesn't
> suit me. It might be exactly right for some other folks though.
>
If it helps soothe your mind, the Win32 version is pure Ruby. :slight_smile:

I'm not clear what this means. Can it be distributed as a gem for use
on Windows ,Unix, and other platforms?

PS - I updated the description of sys-uname on the RAA, so hopefully
folks will discover it a little easier in the future.

That's a good idea.

M

···

On 6/29/05, Daniel Berger <Daniel.Berger@qwest.com> wrote:

--
Matt Mower :: http://matt.blogs.it/