[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Smart(er) platform detection

Berger, Daniel

6/29/2005 1:54:00 PM

> -----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:

Please see sys-uname.

Regards,

Dan


3 Answers

Matt Mower

6/29/2005 2:02:00 PM

0

Hi Dan,

On 6/29/05, Berger, Daniel <Daniel.Berger@qwest.com> wrote:
> 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

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


Berger, Daniel

6/29/2005 2:05:00 PM

0

Matt Mower wrote:
> Hi Dan,
>
> On 6/29/05, Berger, Daniel <Daniel.Berger@qwest.com> wrote:
>
>>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. :)

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.


Matt Mower

6/29/2005 2:49:00 PM

0

On 6/29/05, Daniel Berger <Daniel.Berger@qwest.com> wrote:
> > 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. :)
>

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

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