Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Bundler doesn't use the right gems location #2667

Closed
felipec opened this issue Oct 6, 2013 · 10 comments
Closed

Bundler doesn't use the right gems location #2667

felipec opened this issue Oct 6, 2013 · 10 comments

Comments

@felipec
Copy link

felipec commented Oct 6, 2013

The documentation of bundle install says this:

"This defaults to the gem home, which is the location that gem install installs gems to."

However, that's not true. My distribution has the following in '/etc/gemrc': gem: --user-install. Which means gem install foo works, but bundler doesn't work.

At the very least bundle install should have a similar --user-install option, and perhaps even read gemrc, that would be the only way to make sure it does the same as gem install.

@indirect
Copy link
Member

indirect commented Oct 7, 2013

I'll note that it is the location that gem install installs to by default, but your distribution forcing everyone to use Rubygems' --user-install option doesn't make the documentation wrong. gem install does in fact default to installing gems into $GEM_HOME, and Bundler also defaults to that location. Bundler and Rubygems have different mechanisms for specifying a different location to install to. Use bundle install --path vendor/bundle (or whatever path you want).

@indirect indirect closed this as completed Oct 7, 2013
@felipec
Copy link
Author

felipec commented Oct 7, 2013

I'll note that it is the location that gem install installs to by default

Only on certain systems.

but your distribution forcing everyone to use Rubygems' --user-install option

Nobody is being forced. Users can do --no-user-install, or --install-dir.

doesn't make the documentation wrong

Yes it does.. The documentation says 'This defaults to the gem home, which is the location that gem install installs gems to', and that's demonstrably false. The location that gem install installs gems to depends not only of /etc/gemrc, but ~/.gemrc as well.

Use bundle install --path vendor/bundle (or whatever path you want).

I want 'bundle install' to install to the same location 'gem install' installs to.

The bottom line is that gem install works, and bundle install doesn't work. It doesn't matter how many excuses you give, gem install still works, and bundle install still doesn't work.

Even if there was no /etc/gemrc, the user might have ~/.gemrc configured, or might even want the equivalent of gem install --user-install. In each of these cases the user doesn't need to know what is the actual directory used for user gems (Gem.user_dir), (s)he wants the application to figure that by itself. gem install --user-install does the trick, bundle install doesn't.

@indirect
Copy link
Member

indirect commented Oct 7, 2013

Thank you for your feedback. Bundler will not be changing the way it installs gems to honor .gemrc files. If you would like Bundler to always install to the --user-install directory, use bundle config --global path ~/.gems (or whatever the directory path is).

If you'd like to add a --user-install option to Bundler that sets the installed path to Gem.user_dir, I would be happy to merge it.

On Oct 7, 2013, at 11:57 AM, Felipe Contreras notifications@github.com wrote:

I'll note that it is the location that gem install installs to by default

Only on certain systems.

but your distribution forcing everyone to use Rubygems' --user-install option

Nobody is being forced. Users can do --no-user-install, or --install-dir.

doesn't make the documentation wrong

Yes it does.. The documentation says 'This defaults to the gem home, which is the location that gem install installs gems to', and that's demonstrably false. The location that gem install installs gems to depends not only of /etc/gemrc, but ~/.gemrc as well.

Use bundle install --path vendor/bundle (or whatever path you want).

I want 'bundle install' to install to the same location 'gem install' installs to.

The bottom line is that gem install works, and bundle install doesn't work. It doesn't matter how many excuses you give, gem install still works, and bundle install still doesn't work.

Even if there was no /etc/gemrc, the user might have ~/.gemrc configured, or might even want the equivalent of 'gem install --user-install'. In each of these cases the user doesn't need to know what is the actual directory used for user gems (Gem.user_dir), (s)he wants the application to figure that by itself. gem install --user-install does the trick, bundle install doesn't.


Reply to this email directly or view it on GitHub.

@felipec
Copy link
Author

felipec commented Oct 7, 2013

Thank you for your feedback. Bundler will not be changing the way it installs gems to honor .gemrc files.

If that's the case, the documentation is still wrong.

If you would like Bundler to always install to the --user-install directory, use bundle config --global path ~/.gems (or whatever the directory path is).

I would like Bundler to use the same location gem install uses.

bundle config --global would be a reasonable option it if used /etc/bundle/config (or something along the lines), so Bundler could be packaged by Arch Linux to use the same location as gem install. But that doesn't work.

If you'd like to add a --user-install option to Bundler that sets the installed path to Gem.user_dir, I would be happy to merge it.

I would do it if I had any trust in the project. The first time I use Bundler it doesn't work. I report a problem that clearly would affect all Arch Linux users and it gets immediately closed. Why would I even use Bundler? I can just grep the Gemfile and use gem install directly. So much for Bundler's convenience.

indirect added a commit that referenced this issue Oct 7, 2013
@indirect
Copy link
Member

indirect commented Oct 7, 2013

If that's the case, the documentation is still wrong.

I've updated the documentation in c83b7ce.

I would like Bundler to use the same location gem install uses.

That's a) not how bundler works, and b) not possible.

bundle config --global would be a reasonable option it if used /etc/bundle/config (or something along the lines), so Bundler could be packaged by Arch Linux to use the same location as gem install. But that doesn't work.

Bundler's configuration is per-user.

I would do it if I had any trust in the project. The first time I use Bundler it doesn't work. I report a problem that clearly would affect all Arch Linux users and it gets immediately closed. Why would I even use Bundler? I can just grep the Gemfile and use gem install directly. So much for Bundler's convenience.

The point of Bundler is not to make it easy to install gems. If that's what you want, please don't use Bundler.

@felipec
Copy link
Author

felipec commented Oct 7, 2013

If that's the case, the documentation is still wrong.

Still wrong:

"which is also the default location where gem install installs gems"

It's not.

That's a) not how bundler works, and b) not possible.

Everything is possible. If I write the patch would you apply it?

Bundler's configuration is per-user.

Which is why it doesn't work.

The point of Bundler is not to make it easy to install gems. If that's what you want, please don't use Bundler.

I won't. And I'll make sure Rubinius updates it's install instructions to avoid bundler, which clearly doesn't do what they expect.

@indirect
Copy link
Member

indirect commented Oct 7, 2013

It's not.

Yes, it actually is. --user-install is not enabled by default.

Everything is possible. If I write the patch would you apply it?

Only a subset of gems listed in the gemfile can be installed in a way Rubygems understands. The Rubygems team has definitively stated that they do not and never will support the git and path gems that Bundler also supports, so it isn't possible, even if Bundler were to respect the gemrc file.

I won't. And I'll make sure Rubinius updates it's install instructions to avoid bundler, which clearly doesn't do what they expect.

Good luck with that.

@felipec
Copy link
Author

felipec commented Oct 7, 2013

Yes, it actually is. --user-install is not enabled by default.

It is here, on all Arch Linux machines.

Only a subset of gems listed in the gemfile can be installed in a way Rubygems understands.

That's a red herring.

I said I want bundle install to use the same location gem install uses, and I'm positive I can write a patch that does exactly that.

So it is possible, you just don't want to.

@ioquatix
Copy link

I came here and read the discussion. I agree with @felipec, it's confusing that bundle install doesn't install to the same location as gem install when using /etc/gemrc in the manor specified.

@Karamorf
Copy link

Karamorf commented Jun 17, 2016

I agree as well. It doesn't need to be the default way bundler handles gem install, but there should be a flag that either looks for the "user-install" setting in ~/.gemrc and /etc/gemrc or some other way to follow where "gem install" actually installs things to.

I think there are two use cases conflicting here. The primary case that bundler solves extremely well is dependency management for projects that are getting deployed to various environments/servers.

The other case where this setup hurts is where you want to have dependency management for helper scripts. These scripts aren't deployed to environments or any sort of project in the classic software development world. These are for diagnosing user problems, mining data for information, etc. and will always be manually used by a person. In this case, why on earth would I want to pollute by system ruby with random gems from this? I guess I should look at getting rvm installed specifically for this, but that seems like overkill when all I need to do to maintain my workstation is separate user gems from system gems.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants