Skip to content

Commit

Permalink
Add support for a default-gems file
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagoa committed Apr 24, 2017
1 parent 6586e1e commit 97e9c83
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions bin/install
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 97e9c83

Please sign in to comment.