From: Hongli Lai Date: 2009-05-29T21:34:32+09:00 Subject: [ruby-core:23621] Re: Meaning of RUBY_PLATFORM Roger Pack wrote: > Perhaps now is a good time to bring up a thought on adding some more > constants (sorry if this is a repost).. > Currently it is "hard" to know what OS you're on by regex'ing RUBY_PLATFORM > you can't do RUBY_PLATFORM =~ /win/ since it would match darwin, so in > general it causes confusion (and bugs) among gem developers. > That being said, they aren't "huge" bugs and only gem developers who > care about windows have to target them, but it's still...not easy. > > My own wish would be that there was some way easier to discover platform. > One way might be RUBY_OS -> ['linux', 'aix', 'win32', 'win64' etc.] > > Gem::Platform.local seems to almost get us there... > # > but not quite. Maybe I should submit a patch to gems like > Gem::Platform.local.os -> ['windows'] etc. > > Somewhat unrelated is that currently you can't tell from within ruby > what compiler version created it. A way to overcome this might be > something like > COMPILER and COMPILER_VERSION > > ex: > > >> Rubinius::COMPILER > => :gcc > >> Rubinius::COMPILER_VERSION > => "4.0.1 (Apple Inc. build 5490)" > > > Thoughts on either of those? I'm not convinced that this functionality needs to be bundled with Ruby. You could use the 'ohai' library to obtain a lot of system information.