Skip to content

Instantly share code, notes, and snippets.

@kgrz
Created September 18, 2012 10:06
Show Gist options
  • Select an option

  • Save kgrz/3742383 to your computer and use it in GitHub Desktop.

Select an option

Save kgrz/3742383 to your computer and use it in GitHub Desktop.
Shell script experiments for exporting and installing gems for different versions of Ruby
TL;DR
Putting it all together: Make sure you are using the Ruby version that you need to export from
$ gem list > ~/gemlist && rbenv local rbx-1.2.4 && \
gem install `awk -F' ' '{print $1}' ~/gemlist` && rm ~/gemlist
How I got there:
By exporting to a file:
$ gem list > ~/gemlist
$ awk -F' ' '{ print $1}' ~/gemlist
In a single command: (pipes FTW!)
$ gem list | awk -F' ' '{ print $1 }'
Installing in the 2nd version of Ruby:
$ gem install `awk -F' ' '{print $1}' ~/gemlist`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment