-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add GEM_USER_INSTALL environment variable #4028
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Many (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. However, that doesn't work for bundler, which has no global configuration. Many bugs have been opened about this mismatch, but there's no easy clean solution, except this. The environment variable GEM_USER_INSTALL overrides the installation directory (home) so it is the same as the user's home directory, so there's effectively only one directory (and --[no-]user-install has no effect). Distributions can set this variable on, and then finally 'gem install' and 'bundle install' would use the same location without user intervention. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
|
Thanks for opening a pull request and helping make RubyGems and Bundler better! Someone from the RubyGems team will take a look at your pull request shortly and leave any feedback. Please make sure that your pull request has tests for any changes or added functionality. We use GitHub Actions to test and make sure your change works functionally and uses acceptable conventions, you can review the current progress of GitHub Actions in the PR status window below. If you have any questions or concerns that you wish to ask, feel free to leave a comment in this PR or join our #rubygems or #bundler channel on Slack. For more information about contributing to the RubyGems project feel free to review our CONTRIBUTING guide |
|
Thanks for your contribution @felipec. However, I don't like this solution. If you're willing to set an environment variable, why not setting |
|
@deivid-rodriguez If I set There's a reason gems are installed to |
|
Right, sorry, |
|
@deivid-rodriguez Yes, but I don't want to set two configurations. |
|
Sure, you want a clean solution and I give you a workaround. I'd like to think a bit more about what the cleanest solution is. |
|
The environment variable approach has the advantage of being opt-in for the majority of users (those developing using version managers, like rbenv, rvm, chruby and so on), but with the possibility of being provided by default to OS ruby packages users (if OS packagers set it by default on their integrations). This is something I didn't consider initially and I admit feels nice. Pinging OS packagers @terceiro and @voxik since I'd also like to hear their opinions about this. I believe many OS package users don't use |
They may not normally use bundler, but occasionally the may download the source code of a project that uses bundler. |
|
Let's have a fresh discussion about this at #4031. |
Many (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.
However, that doesn't work for bundler, which has no global
configuration.
Many bugs have been opened about this mismatch, but there's no easy
clean solution, except this.
The environment variable GEM_USER_INSTALL overrides the installation
directory (home) so it is the same as the user's home directory, so
there's effectively only one directory (and --[no-]user-install has no
effect).
Distributions can set this variable on, and then finally 'gem install'
and 'bundle install' would use the same location without user
intervention.
Fixes issue #4027.
Signed-off-by: Felipe Contreras felipe.contreras@gmail.com