Skip to content

Instantly share code, notes, and snippets.

@lachie
Forked from benschwarz/Why & more info
Created November 18, 2009 01:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lachie/237477 to your computer and use it in GitHub Desktop.
Save lachie/237477 to your computer and use it in GitHub Desktop.
function __init_ruby
set -xg ARCHFLAGS '-arch x86_64' # build gemses on Snowy
set -l lastruby (cat ~/.lastruby ^/dev/null)
if test -z $lastruby
set lastruby system
end
rvm $lastruby
end
# Install gems locally, and only locally, without gem complaining
# about path access, and ensuring access to executables.
#
# Goes in config.fish
__init_ruby
# Install gems locally, and only locally, without gem complaining
# about path access, and ensuring access to executables.
#
# Goes in .bash_profile or .bash_login.
export GEM_PATH="$HOME/.gem/ruby/1.8"
export GEM_HOME="$HOME/.gem/ruby/1.8"
export PATH="$HOME/.gem/ruby/1.8/bin:$PATH"
function rvm
set -l gems ''
set -l ruby ''
if test ! $argv[1]
set argv[1] '<nothing>'
end
switch $argv[1]
case system
set gems $HOME/.gem-system
set ruby /usr/bin/ruby
# for other rubies add somthing like the following.
# the important principle is that I don't want to mix gems between versions
# cause its bad for space-time.
# case r19
# set gems $HOME/.gem-1.9
# set ruby ~/homebrew/.../ruby19/bin/ruby # whatever the path is
case '*'
echo 'hey, ruby needs to be one of [system]'
return
end
echo $argv[1] > ~/.lastruby
set -xg GEM_HOME $gems
set -xg GEM_PATH $gems
set -xg PATH $gems/bin (dirname $ruby) $PATH
end
http://ujihisa.blogspot.com/2009/06/rubygems-best-practice.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment