I've a ruby gem that has different dependencies for each OS. I have to explicitly write all of them down:
On Mac OS X:
gem install livereload
on Linux:
gem install rb-inotify livereload
on Windows:
gem install eventmachine-win32 win32-changenotify win32-event livereload
Can I tweak a gemspec a bit so installation instructions would look like plain gem install livereload
for every OS?
When you use the --user-install option, RubyGems will install the gems to a directory inside your home directory, something like ~/. gem/ruby/1.9. 1 . The commands provided by the gems you installed will end up in ~/.
A Gemfile is a file that is created to describe the gem dependencies required to run a Ruby program. A Gemfile should always be placed in the root of the project directory.
The proper way to do this is outlined here. Since the gemspec is evaluated at package time, you need to do it in a native extension. Don't worry, it's not that scary since its still just Ruby code (not compiling C or anything).
We are currently using this approach for some client tools for OpenShift (source). Then in your gemspec/Rakefile, instead of adding dependencies, you would add an extension. Note that the file needs to be named ext/mkrf_conf.rb
for this to work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With