I am using rbenv to manage my gems, locally in my projects but also globally, on a Linux box.
When I bump my global ruby version (set in ~/.rbenv/version
), I always forget to install some of my utility gems, that I need for development mainly.
Examples are rubocop for linting, minitest for some scripts I have scattered in my files, etc.
Using my package manager is not a really flexible solution (not so up-to-date, many gems are not packaged etc).
How should I proceed to keep a list of these gems I want to always have globally accessible, whatever the project I am currently working on? Should I have a Gemfile and a Gemfile.lock in my home directory? How could I hide them then (.Gemfile/.Gemfile.lock)?
So that once I change the global ruby version, then a
$ gem install bundler
$ bundle
and I have everything up and running?
In this case would I have to prepend every command with bundle exec
?
Is there a better way to manage this problem that I am not aware of?
I suggest using
rbenv-default-gems
.Just install it into rbenv's plugins folder:
Place a file named
default-gems
into your rbenv's root folder:Add gems in
$(rbenv root)/default-gems
by name, one per line. You may need to optionally specify a version string after the name, or--pre
to install a pre-release version. For example: