Wednesday October 14, 2009
If I could just get the stupid thing to build
Rake should be on the default PATH...
I can convince myself of anything. When we updated from RubyGems 0.9.4 to 1.3.5 I decided that it was ok for the 'rake' command to be in the $GEM_HOME/bin which then translated to /var/ruby/1.8/gem_home/bin. I justified it because users could run 'gem env', look at the "EXECUTABLE DIRECTORY" and see that they had to add /var/ruby/1.8/gem_home/bin to their $PATH env var. Having had to install and then run rake several times on different systems over the last few days I can see that this is wrong. I want to 'gem install rake' and then run 'rake <some rake task>' without the need to update my PATH. I'm certain that others will agree that this is how it should be.
I could easily change the way that we build RubyGems such that the "EXECUTABLE DIRECTORY" defaults to /usr/bin but I have no way of being certain that when the end user runs 'gem install <some gem with an executable>' that /usr/bin will actually be writable even by root (or the root role as used by pfexec). We have the Rails package in the /contrib repository that also delivers the Rake gem. This package installs the 'rake' executable to /usr/bin, but it's a bit much to ask you to install Rails just to get Rake. I seem to have the following options:
- With the SUNWruby18 package on OpenSolaris, provide wrapper scripts in /usr/bin for the popular gems that deliver executables. These would emit a message saying to install the require Gem should it not already be installed and run as normal if it is. This has a few corner cases that have to be considered
- Provide a /contrib package that provides wrapper scripts for popular gems which would work as described in (1)
- Change "EXECUTABLE DIRECTORY" to /usr/bin and modify RubyGems to detect the writability of /usr/bin. It does this by default but would end up installing any affected gems in root's ~/.gem directory.
I favour option 3, but only if it can be done without significant changes to RubyGems.
Posted at 01:19PM Oct 14, 2009 by MandyWaite in Open Source | Comments[2]
Doesn't the rubygems runtime already handle that? e.g.
→ gem install rake
WARNING: Installing to ~/.gem since /Library/Ruby/Gems/1.8 and
/usr/bin aren't both writable.
Posted by David Turnbull on October 14, 2009 at 03:36 PM BST #
It does, but if you are installing the gem with sudo or as root (or with pfexec on OpenSolaris) and /usr/bin isn't writable, the gem will install to root's ~/.gem and will then only be accessible by root. Maybe everyone installs gems to ~/.gem as their normal, non-root user and this therefore isn't a massive problem. It would be interesting to hear more feedback.
Posted by Mandy Waite on October 14, 2009 at 03:53 PM BST #