[ANN] os gem: initial release: easier platform management

Initial release of the OS gem.
The OS gem allows for some easy telling if you’re on windows or not.

require ‘os’
OS.windows?
=> true

OS.bits
=> 32

OS.java?
=> true

OS.ruby_exe
=> “c:\ruby18\bin\ruby.exe” # or “/usr/local/bin/ruby” or what not

OS.posix?
=> false

If there are any other features you’d like, let me know.

Related:
Gem.ruby
Platform gem

-rp

On 14.01.2010 21:55, Roger P. wrote:

OS.ruby_exe
=> “c:\ruby18\bin\ruby.exe” # or “/usr/local/bin/ruby” or what not

I’d alias this to #ruby_bin since that is more natural on non-Windows
platforms.

OS.posix?
=> false

If there are any other features you’d like, let me know.

I’d make #posix? more robust, too, since !OS.windows just tests if an OS
isn’t Windows, not if it is POSIX compliant. :wink:

Especially since Windows can have a POSIX subsystem:
http://en.wikipedia.org/wiki/Interix

And there’s even a Ruby port for Interix:
http://debian-interix.net/

Phillip G. wrote:

OS.ruby_exe
=> “c:\ruby18\bin\ruby.exe” # or “/usr/local/bin/ruby” or what not

I’d alias this to #ruby_bin since that is more natural on non-Windows
platforms.

Good idea. I released a new version that only has ruby_bin :slight_smile:

I’d make #posix? more robust, too, since !OS.windows just tests if an OS
isn’t Windows, not if it is POSIX compliant. :wink:

Good idea. Implemented a first hack at it, though I haven’t download
interix’ ruby to test it :slight_smile:
-r

Roger P. wrote:

Initial release of the OS gem.
The OS gem allows for some easy telling if you’re on windows or not.

require ‘os’
OS.windows?
=> true

OS.bits
=> 32

OS.java?
=> true

OS.ruby_exe
=> “c:\ruby18\bin\ruby.exe” # or “/usr/local/bin/ruby” or what not

OS.posix?
=> false

If there are any other features you’d like, let me know.

Does it do OS.mac? yet? If not, that would be nice, particularly for
JRuby/Swing apps where certain UI stuff is done differently for Mac OS.

github.com/rdp/os

Related:
Gem.ruby
Platform gem

-rp

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

If there are any other features you’d like, let me know.

Does it do OS.mac? yet? If not, that would be nice, particularly for
JRuby/Swing apps where certain UI stuff is done differently for Mac OS.

Great idea.
-r

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs