M
Matt Mower
Hi folks,
I recently got bitten by some code which uses an idiom like:
if RUBY_PLATFORM =3D~ /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:
http://matt.blogs.it/2005/06/29.html#a1882
at the moment it's a single require to get definitions of:
Platform::OS (e.g. :unix or :win32)
Platform::IMPL (e.g. :macosx or :mingw)
Platform::ARCH (e.g. owerpc or :x86)
or :unknown if it can't figure your platform out.
I'd be very grateful if everyone on the list would please take a
moment download the 'platform.rb' code and run it as 'ruby
platform.rb' and check that it prints out sensible values for ::OS,
::IMPL, and ::ARCH.
If not please either reply here or in a comment to the post including
the output of
ruby -e 'puts RUBY_PLATFORM'
and what you would expect ::OS, ::IMPL, and ::ARCH to be for your platform.
I'd like to get as comprehensive coverage as possible and then release
this as a library that people can depend upon for detecting platform
differences.
Regards,
Matt
--=20
Matt Mower :: http://matt.blogs.it/
I recently got bitten by some code which uses an idiom like:
if RUBY_PLATFORM =3D~ /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:
http://matt.blogs.it/2005/06/29.html#a1882
at the moment it's a single require to get definitions of:
Platform::OS (e.g. :unix or :win32)
Platform::IMPL (e.g. :macosx or :mingw)
Platform::ARCH (e.g. owerpc or :x86)
or :unknown if it can't figure your platform out.
I'd be very grateful if everyone on the list would please take a
moment download the 'platform.rb' code and run it as 'ruby
platform.rb' and check that it prints out sensible values for ::OS,
::IMPL, and ::ARCH.
If not please either reply here or in a comment to the post including
the output of
ruby -e 'puts RUBY_PLATFORM'
and what you would expect ::OS, ::IMPL, and ::ARCH to be for your platform.
I'd like to get as comprehensive coverage as possible and then release
this as a library that people can depend upon for detecting platform
differences.
Regards,
Matt
--=20
Matt Mower :: http://matt.blogs.it/