From: Rick DeNatale Date: 2009-05-29T07:08:53+09:00 Subject: [ruby-core:23602] Re: Meaning of RUBY_PLATFORM On Thu, May 28, 2009 at 2:52 PM, Luis Lavena wrote: > On Thu, May 28, 2009 at 3:41 PM, Rick DeNatale wrote: >> The RUBY_PLATFORM constant is documented in the latest Pickaxe as "The >> identifier of the platform running this program." >> >> Actually it appears to actually be the identifier of the platform on >> which ruby was compiled. For example, I'm running a darwin ports >> version of Ruby installed back when this machine was running OS X 10.4 >> (Tiger), it has since been upgraded to Leopard 10.5.7 >> >> $ ruby -e'p RUBY_PLATFORM;p `uname -a`' >> "i686-darwin8.11.1" >> "Darwin Macintosh-3.local 9.7.0 Darwin Kernel Version 9.7.0: Tue Mar >> 31 22:52:17 PDT 2009; root:xnu-1228.12.14~1/RELEASE_I386 i386\n" >> >> Note the difference. >> > > On my case, RUBY_PLATFORM is reporting "universal-darwin-9.0' > > And Gem::Platform.local: > > # > >> I just noticed this today when I tried out a new OS X specific gem >> which baled out when it tought I was running a back-level version of >> OS X. >> > > Unless there is a i386 or ppc code there (like you're compiling with > inline assembler or something) then RUBY_PLATFORM =~ /darwin/ should > be enough. > > Can you tell me which Gem? (just curious). The gem is autospec-mac which is looking at the version of OS X to determine if it has fsevent support. This isn't an issue of installing the gem, it is looking at runtime to determine if the service can be used, if so it then forks execution (with backticks) of a binary provided with the gem. This is an OS X only gem which allows autotest to be driven by file system events rather than having to poll the filesystem for changed files, it also adds working growl notifications. That gem was actually split into two gems autospec-fsevent and autospec-growl. the autospec-fsevent gem is now looking at not only the major version of OS X, but the minor one since the fsevent service seems to be there starting with 8.9. I opened a ticket with the gem author suggesting that he use `uname -a` rather than RUBY_PLATFORM to determine the OS version, since RUBY_PLATFORM is showing the version at the time that ruby was compiled/configured. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale