Skip to content

Instantly share code, notes, and snippets.

@sferik
Created March 31, 2011 06:41
Show Gist options
  • Save sferik/895921 to your computer and use it in GitHub Desktop.
Save sferik/895921 to your computer and use it in GitHub Desktop.
function for_each_ruby {
for ruby in `rvm list strings`
do
echo "rvm use $ruby; $1;"
done
}
default_gems=`cat ~/.rvm/gemsets/default.gems | tr '\n' ' '`
alias install_default_gems=`for_each_ruby "yes | gem install $default_gems"`
alias update_all_gems=`for_each_ruby "yes | gem update; yes | gem cleanup"`
@sferik
Copy link
Author

sferik commented Mar 31, 2011

The general problems I'm trying to solve are:

  1. Sometimes I add a gem to my default gemset and want to install it across all the rubies on my system.
  2. When a new versions of gems are released, I want to install them across all the rubies on my system (and remove the old versions).

@dkubb
Copy link

dkubb commented Mar 31, 2011

See my fork for another approach. The rvm exec command will run the supplied command against all installed rubies.

All of the gem commands you're using, except gem cleanup, accept the -f flag to force them so no need to pipe in yes into those.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment