Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Most people don't install gems in the default directory, but in the user's directory (--user-install), this can be configured by distributions using /etc/gemrc, but that doesn't work for bundler since it doesn't read gem configurations. The default installation directory should be Gem.user_dir, not Gem.default_dir, but changing this invariably would break backwards compatibility. Instead we can add another default directory which is where gems will be installed to by default. Gem.default_dir is where the system gems are installed to, Gem.default_install is where the gems installed by the user are installed to. The method Gem.default_install can be overridden by distributions to Gem.user_dir, therefore making all installations user installations by default (essentially the same as --user-install). This way both bundler and gem will install gems in the same directory by default without users having to manually set GEM_HOME to volatile locations such as $HOME/.local/share/gem/ruby/3.0.0. All distributions need to do is turn this new behavior on. If a user has sudo privileges, he/she can do --no-user-install to install gems in the system directory (Gem.default_dir), which is the current default behavior. The current behavior remains unaffected: gems are still installed to Gem.default_dir by default. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
- Loading branch information