DEV Community

Discussion on: Completely Remove Ruby 2.7's Default Bundler

Collapse
 
hsbt profile image
SHIBATA Hiroshi

--default option of gem command will not install the library files. I think you can use the bundler-1.x with simply gem install bundler -v 1.17.3. After that, The bundler switcher of RubyGems can detect the old version of bundler automatically.

Collapse
 
st0012 profile image
Stan Lo

Thanks for the comment! But I just tried it with freshly installed Ruby 2.7.1 and it didn't work 🤔

First, I made sure I only have the default bundler 2.1.4. And then I installed version 1.17.3

$ ruby -v
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin19]

$ gem list bundler
*** LOCAL GEMS ***

bundler (default: 2.1.4)

$ gem install bundler -v 1.17.3                                                                                                                                                                                                              Fetching bundler-1.17.3.gem
Successfully installed bundler-1.17.3
Parsing documentation for bundler-1.17.3
Installing ri documentation for bundler-1.17.3
Done installing documentation for bundler after 2 seconds
1 gem installed

$ gem list bundler

*** LOCAL GEMS ***

bundler (default: 2.1.4, 1.17.3)

But after installing version 1.17.3 it still uses 2.1.4, which can't be uninstalled.

$ bundle -v
Bundler version 2.1.4

$ gem uninstall 2.1.4
Gem '2.1.4' is not installed

$ gem uninstall bundler -v 2.1.4
Gem bundler-2.1.4 cannot be uninstalled because it is a default gem

Now if I create a new Gemfile and run bundle install, it'll still use 2.1.4 instead of 1.17.3.

$ echo "source 'https://rubygems.org'" >> Gemfile

$ bundle
The Gemfile specifies no dependencies
Resolving dependencies...
Bundle complete! 0 Gemfile dependencies, 1 gem now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.

$ cat Gemfile.lock
GEM
  remote: https://rubygems.org/
  specs:

PLATFORMS
  ruby

DEPENDENCIES

BUNDLED WITH
   2.1.4

Did I miss anything?

Collapse
 
hsbt profile image
SHIBATA Hiroshi

You can use bundler-1.17.3 with bundle __1.17.3__ install. Or After you update 2.1.4 to 1.17.3 on BUNDLED WITH field, You can use bundler-1.17.3 with bundle command.