Skip to content

Default bundler version for ruby 2.6.x installations #2842

@pclalv

Description

@pclalv

I have applications that require bundler 2.0.2 and ruby 2.6.3. Ruby 2.6.3 comes with bundler 1.17.2, so I need to install bundler 2.0.2; after I install bundler 2.0.2, I have two version of bundler. Invoking gem uninstall bundler --version 1.17.2 doesn't seem to be able to uninstall the bundler provided by ruby 2.6.x, so at this point I need to be able to guarantee that I use the correct one. Is there some means of selecting the bundler that I want (2.0.2) so that I can avoid running the bundler that I don't want (1.17.2)? I know that I can request that bundler 2.0.2 be used by invoking, for example, bundle _2.0.2_ exec ..., but that's not what I want - I don't want to have to do that every time I need to invoke bundler, and it's impractical in my containerized ruby environments . I would like to avoid any kind of homegrown shim (whether shell alias, shell function, or shell script) that tries to figure out what version of bundler should be used. I see too that there's a --default option that can be passed to gem install, but it's not clear to me how that might help me. This is what I saw after running gem install bundler --version 2.0.2 --default with a fresh ruby 2.6.3 installation:

$ gem list bundler

*** LOCAL GEMS ***

bundler (default: 2.0.2, default: 1.17.2)

For now, it seems like the best workaround is to programmatically edit the bundler executable provided by RubyGems so that my desired bundler version is always assigned to version.

I was hoping that RubyGems would provide some means of selecting a default bundler version, say by an environment variable BUNDLER_DEFAULT_VERSION. Does anything like that exist? If not, would it be reasonable for RubyGems to provide such a mechanism? Is there a bug in any of the behavior I've observed? Or is all of this behavior intended?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions