Install Bundler in older Ruby versions#501
Open
leoarnold wants to merge 1 commit into
Open
Conversation
In Ruby versions prior to 2.6 is not installed by default. For the skilled `asdf` user, the solution may _seem_ pretty simple ```shell gem install bundler asdf reshim ruby ``` This will run into yet another problem because `gem` command will simply select the latest available version of `bundler` and then tell you that it is not compatible with your Ruby version. Depending on the version of RubyGems, it may not even suggest a compatible version of `bundler. For the casual `asdf` user, things get even more confusing because they probably also have a contemporary version of Ruby installed (which as the `bundle` command shimmed), so `asdf` will suggest to use the modern Ruby version (instead of telling you how to get `bundler` installed): ```shell $ bundle No version is set for command bundle Consider adding one of the following versions in your config file at /home/johndoe/.tool-versions ruby 4.0.5 ``` Therefore it makes sense to have the `asdf` Ruby plugin install `bundler` by default. Any compatible version of Bundler will do since `Gemfile.lock` specifies the Bundler version required by the project, and the `bundle` command will respond to this. In this commit, we choose to address the issue in the following way: - Ruby v1.8 and below: This is expert territory and will be skipped. Ruby v1.8.7 reached end of life on 2014-07-31 and many projects using this version of below may not even use `bundler` in the first place. - Ruby v2.6 and above: The `bundler` gem is installed by default. We still check for the gem, but the test should pass and nothing needs to be done. - Ruby v1.9 to v2.5: Here we need to install a version of Bundler. Version 1.17.3 is the last v1 release of Bundler and widely accepted as the trusty version of Bundler to use when in doubt, so we will do just that. With this change, `bundler` will be installed and shimmed even when using legacy versions of Ruby, so even casual users of `asdf` will have a pleasent experience.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In Ruby versions prior to 2.6 is not installed by default. For the skilled
asdfuser, the solution may seem pretty simpleThis will run into yet another problem because
gemcommand will simply select the latest available version ofbundlerand then tell you that it is not compatible with your Ruby version. Depending on the version of RubyGems, it may not even suggest a compatible version ofbundler.For the casual
asdfuser, things get even more confusing because they probably also have a contemporary version of Ruby installed (which as thebundlecommand shimmed), soasdfwill suggest to use the modern Ruby version (instead of telling you how to getbundlerinstalled):Therefore it makes sense to have the
asdfRuby plugin installbundlerby default. Any compatible version of Bundler will do sinceGemfile.lockspecifies the Bundler version required by the project, and thebundlecommand will respond to this.In this commit, we choose to address the issue in the following way:
bundlerin the first place.bundlergem is installed by default. We still check for the gem, but the test should pass and nothing needs to be done.With this change,
bundlerwill be installed and shimmed even when using legacy versions of Ruby, so even casual users ofasdfwill have a pleasent experience.