[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Get system name

Kless

10/14/2008 5:28:00 PM

Is there any method that returns the operating sytem being used?
8 Answers

Victor H. Goff III

10/14/2008 5:36:00 PM

0

[Note: parts of this message were removed to make it a legal post.]

Check out the Ruby Constants... PLATFORM could be one.

The Higgs bozo

10/14/2008 6:04:00 PM

0

Victor Goff wrote:
> Check out the Ruby Constants... PLATFORM could be one.

The constant is RUBY_PLATFORM.

If more info is needed, check the output of this,

require 'rbconfig'
require 'pp'
pp Config::CONFIG

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

Mark Firestone

10/14/2008 6:08:00 PM

0

[Note: parts of this message were removed to make it a legal post.]

That's a great alias! I wish I'd thought of it.
Now someone unsubscribe me from this list, dammit. I can't figure out how,
cause I'm a moron!

(Just kidding, don't really unsub me...)

On Tue, Oct 14, 2008 at 7:03 PM, The Higgs bozo <higgs.bozo@gmail.com>wrote:

>
> --
Angels and ministers of grace defend us!

- Hamlet, Act I, Scene 4

Kless

10/14/2008 6:43:00 PM

0

On 14 oct, 19:03, The Higgs bozo <higgs.b...@gmail.com> wrote:
> Victor Goff wrote:
> > Check out the Ruby Constants... PLATFORM could be one.
>
> The constant is RUBY_PLATFORM.
I haven't that constant, but 'target_os'.

The Higgs bozo

10/14/2008 7:17:00 PM

0

Kless wrote:
> On 14 oct, 19:03, The Higgs bozo <higgs.b...@gmail.com> wrote:
>> Victor Goff wrote:
>> > Check out the Ruby Constants... PLATFORM could be one.
>>
>> The constant is RUBY_PLATFORM.
> I haven't that constant, but 'target_os'.

RUBY_PLATFORM is a top-level constant, apart from Config::CONFIG.

$ ruby -e 'p RUBY_PLATFORM'
--
Posted via http://www.ruby-....

Daniel Berger

10/14/2008 7:26:00 PM

0



On Oct 14, 12:03=A0pm, The Higgs bozo <higgs.b...@gmail.com> wrote:
> Victor Goff wrote:
> > Check out the Ruby Constants... PLATFORM could be one.
>
> The constant is RUBY_PLATFORM.

I recommend against this because of JRuby (and probably IronRuby).
JRuby, for example, will return "java" for RUBY_PLATFORM.

> If more info is needed, check the output of this,
>
> require 'rbconfig'
> require 'pp'
> pp Config::CONFIG

There you go. Take a look at Config['host_os'].

Regards,

Dan

The Higgs bozo

10/14/2008 7:56:00 PM

0

Daniel Berger wrote:
> On Oct 14, 12:03�pm, The Higgs bozo <higgs.b...@gmail.com> wrote:
>> Victor Goff wrote:
>> > Check out the Ruby Constants... PLATFORM could be one.
>>
>> The constant is RUBY_PLATFORM.
>
> I recommend against this because of JRuby (and probably IronRuby).
> JRuby, for example, will return "java" for RUBY_PLATFORM.
>
>> If more info is needed, check the output of this,
>>
>> require 'rbconfig'
>> require 'pp'
>> pp Config::CONFIG
>
> There you go. Take a look at Config['host_os'].

I wonder if RUBY_PLATFORM should be deprecated, then?

I've used 'target_os' in the past, a decision I rationalized thusly: on
the off chance that ruby spits out an executable of any form, I want the
platform of that executable. In hindsight I wonder if it makes any
sense.

Is there an example of CONFIG["target_os"] != CONFIG["host_os"] ?

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

Kless

10/17/2008 10:03:00 AM

0

On 14 oct, 20:55, The Higgs bozo <higgs.b...@gmail.com> wrote:
> Is there an example of CONFIG["target_os"] != CONFIG["host_os"] ?
Yes, my Ubuntu shows:

$ ruby -e 'require "rbconfig"; p Config::CONFIG["host_os"],
Config::CONFIG["target_os"]'

"linux-gnu"
"linux"