Rambling, thoughts and profundities on the subject of security and privacy in Web 2.0 and in particular Virtual Universes technologies. Occasionally I might diverge at bit.

2008/08/24

RubyGems in a local directory


I was trying to install gem in my home directory on the server where my site is to be hosted and read up on it in the RubyGems Manual. The system is a FreeBSD7 system running on Intel iron. So far, some things worked differently than described so I though I'd put them here for posterity:

  1. First I created a directory for the gems and the gem program to reside: ~/lib/ruby (I already had a ~/lib/perl for perly stuff.)
  2. Then I added the line "setenv GEM_HOME $HOME/lib/ruby/gems" to my .cshrc
  3. Dont forget to "source .cshrc"
  4. I unpacked the rubygem package in some directory
  5. Next, after going into that directory, did 'ruby setup.rb config --prefix=~/lib/ruby'. (Note the lack of the trailing 'gems' directory.)
  6. So far so good. This was more or less what the manual described. However, I had to modify the setup command to: 'ruby setup.rb setup --prefix=~/lib/ruby'. In the manual, the --prefix parameter was not there.
  7. The same thing for the actual installation: 'ruby setup.rb install --prefix=~/lib/ruby'.
  8. Next, ruby needed to find the gem libraries, so this line, "setenv RUBYLIB $HOME/lib/ruby/lib" 
  9. I checked the setup using "gem environment" but got an error in rubygems.rb apparently because the user_paths method was getting a string instead of an array. I fixed it by changing the use_paths method to read:
    def self.use_paths(home, paths=[])
    clear_paths
    set_home(home) if home
    if paths
    if paths.is_a? String
    set_paths(paths)
    else
    set_paths(paths.join(File::PATH_SEPARATOR)) if paths
    end
    end
    end
  10. Now "gem environment" seems to work. I'm not sure what the cause of this is and I'll leave it for the moment.
  11. I tried to install rails via "gem install rails" ... and it worked! Apparently. Note the lack of the "sudo" before that line. This is all in my local directory on the server.
I might update this as I find more bugs or quirks.




References:

No comments: