Hi Kevin,

I don't think there is an official method for enabling your gem to be
installed only on some systems. However, you can put some check in the gem
such that only OSX users would be allowed to use the functionality. The
RUBY_PLATFORM constant should be enought for that, as you can see from this
stackoverflow post:

http://stackoverflow.com/questions/170956/how-can-i-find-which-operating-system-my-ruby-program-is-running-on

Hope that helps.


-----
Carlos Agarie
Software Engineer
+55 11 97320-3878 | @carlos_agarie


2014-07-11 10:10 GMT-03:00 Kevin Meaney <ktam / yvs.eu.com>:

> Hi,
>
> I've written a LaunchAgent which is like a unix daemon but runs as a user
> process, not a root/system process for OS X.
>
> I've written some ruby code for working with the launch agent. A
> collection of library routines, a few scripts and a collection of test
> scripts for testing the launch agent. I've currently got no tests for the
> ruby code itself. I've been using yard to generate documentation.
>
> I'm still new to ruby, and am still at the stage that whenever I look at
> code I wrote a couple of months ago I'm embarrassed.
>
> My question relates to creating a ruby gem. I would like to create a gem
> that can only be installed on OS X, and that can only be installed on
> Mavericks and above. I want to keep the barrier to using my software as low
> as sensibly possible so I'm not interested in installations of RVM and the
> different versions of ruby that it provides access to. I want to make sure
> everything works with the ruby 2.0.0 that comes installed with Mavericks
> and not add complications.
>
> I've been reading the documentation on gemspecs and it is not clear to me
> how I can use the gemfile to limit to OS X Mavericks (or higher) the gem
> can be installed on?
>
> http://guides.rubygems.org/specification-reference/#platform=
>
> I know I'm not using ruby here in the way most people here are using it,
> but when I looked at scripting languages to work with the LaunchAgent, ruby
> looked really interesting as a new language to learn coming from an
> Objective-C C++ background.
>
> Some guidance would be appreciated.
>
> Kevin
>
>