diff --git a/README.md b/README.md index d82d6eb63d2396625a30136fe88bd0c2ca95b00c..c6300c97bea2e7cf02e037de099176bc04562832 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,18 @@ When installing Ruby using `asdf install`, you can pass custom configure options * `RUBY_CONFIGURE_OPTIONS` - use only your configure options * `RUBY_EXTRA_CONFIGURE_OPTIONS` - append these configure options along with ones that this plugin already uses +## Default gems + +asdf-ruby can automatically install a set of default gems right after +installing a Ruby version. To enable this feature, provide a +`$HOME/.default-gems` file that lists one gem per line, for example: + +``` +bundler +pry +gem-ctags +``` + ## Migrating from another Ruby version manager ### `.ruby-version` file diff --git a/bin/install b/bin/install index 16b028f4c84a373e0f58649742d1b2d85b978ac7..a81fe3ba18bb2f6d7a2c4048aca06a74f52b881a 100755 --- a/bin/install +++ b/bin/install @@ -218,4 +218,24 @@ get_ruby_type() { } +install_default_gems() { + local default_gems="${HOME}/.default-gems" + + if [ ! -f $default_gems ]; then return; fi + + echo "" + + for name in $(cat $default_gems); do + echo -n "Installing ${name} gem... " + + if gem install $name > /dev/null 2>&1; then + echo "SUCCESS" + else + echo "FAIL" + fi + done +} + + install_ruby $ASDF_INSTALL_TYPE $ASDF_INSTALL_VERSION $ASDF_INSTALL_PATH +install_default_gems