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

**URL:** <https://www.ruby-forum.com/t/ann-os-gem-initial-release-easier-platform-management/181626>\
**Category:** Ruby\
**Created:** [January 14, 2010, 9:54pm UTC](https://www.ruby-forum.com/t/ann-os-gem-initial-release-easier-platform-management/181626 "2010-01-14T21:54:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rogerdpack](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/45deac/32.png) [@rogerdpack](https://www.ruby-forum.com/u/rogerdpack)\
**Post date:** [January 14, 2010, 9:54pm UTC](https://www.ruby-forum.com/t/ann-os-gem-initial-release-easier-platform-management/181626/1 "2010-01-14T21:54:59Z")

</div>

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.

> **[GitHub - rdp/os: The OS gem allows for some easy telling if you’re on windows...](https://github.com/rdp/os)**
>
> The OS gem allows for some easy telling if you’re on windows or not. OS.windows? as well as some other helper utilities - GitHub - rdp/os: The OS gem allows for some easy telling if you’re on wind...

Related:  
Gem.ruby  
Platform gem

-rp

---

<div class="post-metadata">

**Author:** ![rogerdpack](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/45deac/32.png) [@rogerdpack](https://www.ruby-forum.com/u/rogerdpack)\
**Post date:** [January 14, 2010, 10:26pm UTC](https://www.ruby-forum.com/t/ann-os-gem-initial-release-easier-platform-management/181626/2 "2010-01-14T22:26:31Z")

</div>

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. 😉

Especially since Windows _can_ have a POSIX subsystem:

> **[Interix](https://en.wikipedia.org/wiki/Interix)**
>
> Interix was an optional\[citation needed\], POSIX-conformant\[citation needed\] Unix subsystem for Windows NT operating systems. Interix was a component of Windows Services for UNIX, and a superset of the Microsoft POSIX subsystem. Like the POSIX subsystem, Interix was an environment subsystem for the NT kernel. It included numerous open source utility software programs and libraries. Interix was originally developed and sold as OpenNT until purchased by Microsoft in 1999.
> Interix versions 5.2 and 6...

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

---

<div class="post-metadata">

**Author:** ![rogerdpack](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/45deac/32.png) [@rogerdpack](https://www.ruby-forum.com/u/rogerdpack)\
**Post date:** [January 14, 2010, 10:58pm UTC](https://www.ruby-forum.com/t/ann-os-gem-initial-release-easier-platform-management/181626/3 "2010-01-14T22:58:22Z")

</div>

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 🙂

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

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

---

<div class="post-metadata">

**Author:** ![rogerdpack](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/45deac/32.png) [@rogerdpack](https://www.ruby-forum.com/u/rogerdpack)\
**Post date:** [January 15, 2010, 3:15am UTC](https://www.ruby-forum.com/t/ann-os-gem-initial-release-easier-platform-management/181626/4 "2010-01-15T03:15:48Z")

</div>

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 - rdp/os: The OS gem allows for some easy telling if you’re on windows or not. OS.windows? as well as some other helper utilities](http://github.com/rdp/os)
> 
> Related:  
> Gem.ruby  
> Platform gem
> 
> -rp

## Best,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![rogerdpack](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/45deac/32.png) [@rogerdpack](https://www.ruby-forum.com/u/rogerdpack)\
**Post date:** [January 15, 2010, 5:19pm UTC](https://www.ruby-forum.com/t/ann-os-gem-initial-release-easier-platform-management/181626/5 "2010-01-15T17:19:22Z")

</div>

> > 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
