Hi guys,
On my MacBook I’m noticing I’m having to install a gem three times
(MRI, IronRuby, JRuby) - which is getting really annoying
Am I doing something wrong??? Is there a way around this??
Thanks
Ben
Hi guys,
On my MacBook I’m noticing I’m having to install a gem three times
(MRI, IronRuby, JRuby) - which is getting really annoying
Am I doing something wrong??? Is there a way around this??
Thanks
Ben
What gem?
you can share gems by setting a location in .gemrc
But there be dragons. because gem install will only generate the proper
executable links for the version that is installing the gem.
if you don’t want to download the gems all the time then you can just
reuse
the .gem file from
Assuming you have ruby installed in /usr
/usr/lib/ruby/gems/1.9.1/cache
if you share a location you can use gem pristine gem_name to (re)install
the
gem in the other ruby version.
for libraries that don’t have any executables or native extensions that
should work just fine. the core of the gems functionality is to add the
paths /usr/lib/ruby/gems/1.9.1/gems/*/lib to the load path.
The install process also copies the files from the gem/bin folder to
/usr/lib/ruby/gems/1.9.1/bin and then to /usr/bin
If you use homebrew then this stuff is hidden a little bit deeper
because
homebrew symlinks the lib,bin,var,… folers from within a Cellar
repository.
So in short you should be able to do so but sometimes it might require a
little bit of work to make it dance.
Met vriendelijke groeten - Best regards - Salutations
Ivan Porto C.
Blog: http://flanders.co.nz
Google Wave: [email protected]
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)
Hey Ben,
This is a problem, but one that you’re better of living with. I’ve tried
sharing gem homes in the past and it can get real messy right after you
install your first native gem, of if you have bin scripts like Ivan
pointed out.
Perhaps you could create a wrapper shell script that invokes a gem
install for each flavour of Ruby you have?
Cheers,
Sidu.
Ben, do you mean each implementation is using a different RubyGems
repository, so running “gem list” on each implementation gives you a
different list? To work-around this, set both the “GEM_PATH” and
“GEM_HOME” environment variables to be the RubyGem repo you want to use,
and all the implementations will pull gems from only that one.
For example, dev.bat in IronRuby’s source sets GEM_PATH to be a location
we have checked in, so Ruby and IronRuby share the same gems. If
GEM_HOME was also set, then installing would default to that location.
~js
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs