Skip to content

Instantly share code, notes, and snippets.

@thinkerbot
Created November 8, 2010 18:28
Show Gist options
  • Select an option

  • Save thinkerbot/668037 to your computer and use it in GitHub Desktop.

Select an option

Save thinkerbot/668037 to your computer and use it in GitHub Desktop.

Revisions

  1. thinkerbot created this gist Nov 8, 2010.
    30 changes: 30 additions & 0 deletions gem_env.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    # Two ENV variables control the 'gem' command:
    #
    # GEM_HOME: the single path to a gem dir where gems are installed
    # GEM_PATH: a standard PATH to gem dirs where gems are found
    #
    # A gem directory is a directory that holds gems. The 'gem' command will lay
    # out and utilize the following structure:
    #
    # bin # installed bin scripts
    # cache # .gem files ex: cache/gem_name.gem
    # doc # rdoc/ri ex: doc/gem_name/rdoc
    # gems # gem file ex: gems/gem_name/lib/gem_name.rb
    # specifications # gemspecs ex: specifications/gem_name.gemspec
    #
    # As an example of usage:

    export GEM_HOME=a
    export GEM_PATH=a
    gem install rack
    gem list # shows rack

    export GEM_HOME=b
    export GEM_PATH=b
    gem install rake
    gem list # shows rake (not rack)

    export GEM_PATH=a:b
    gem list # shows rake and rack

    # And if you set GEM_HOME=a:b, you will install into the 'a:b' directory :)