Specify gem installation directory

后端 未结 4 709
温柔的废话
温柔的废话 2020-12-28 13:54

I have some trouble here. I am working with a Rails 2.3 project (working on the production server through ssh - don\'t ask why). Here is the Gemfile. When delayed_jobs is t

4条回答
  •  孤独总比滥情好
    2020-12-28 14:36

    You can add the following to your config.ru file:

    ENV['GEM_HOME']="#{ENV['HOME']}/projects/shared/gems/ruby/1.8/gems"
    ENV['GEM_PATH']="#{ENV['GEM_HOME']}:/var/lib/ruby/gems/1.8"
    require 'rubygems'
    Gem.clear_paths
    

    This will tell your rack app where to look for gems.

    Also configure your server .bashrc:

    export GEM_HOME="$HOME/projects/shared/gems/ruby/1.8/gems"
    export GEM_PATH="$GEM_HOME:/var/lib/ruby/gems/1.8"
    

提交回复
热议问题