Skip to content

Instantly share code, notes, and snippets.

@adammck
Created January 8, 2011 08:37
Show Gist options
  • Save adammck/770682 to your computer and use it in GitHub Desktop.
Save adammck/770682 to your computer and use it in GitHub Desktop.
a quick example session using my rvm fork, demonstrating 'rvm export' in rvmrc.
# see:
# https://github.com/adammck/rvm
# no env vars are defined:
$ echo $TWITTER_API_KEY
# rvm isn't enabled as default:
$ which ruby
/usr/bin/ruby
# the rvmrc in my rails app contains its env vars:
$ cat myproject/.rvmrc
rvm 1.9.2@myproject
rvm export TWITTER_API_KEY=aaaa
rvm export TWITTER_API_SECRET=bbbb
# rvm switches interpreter and gemset as usual:
$ cd myproject
$ which ruby
/Users/adammck/.rvm/rubies/ruby-1.9.2-p136/bin/ruby
$ rvm gemset name
myproject
# but it has also exported my env vars:
$ echo $TWITTER_API_KEY
aaaa
# the vars are reverted when leaving the project:
$ cd ..
$ echo $TWITTER_API_KEY
# to avoid clobbering your shell, existing values are restored:
$ export TWITTER_API_SECRET=xxxx
$ cd myproject
$ echo $TWITTER_API_SECRET
bbbb
$ cd ..
$ echo $TWITTER_API_SECRET
xxxx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment