Bundler fails to install globalid when using Ruby < 2.6.0
|Assignee:||Go MAEDA||% Done:|
The latest version of globalid, 0.5.1, reqruies Ruby 2.6 or later (see https://github.com/rails/globalid/commit/5b255ffd7cdb335febe6fa0f3847a39b3161a9bb). Therefore, if you are using Ruby 2.5 or earlier, `bundle install` will fail to resolve the dependency and abort in some environments.
Fetching globalid 0.5.1 (was 0.4.2) Installing globalid 0.5.1 (was 0.4.2) Gem::RuntimeRequirementNotMetError: globalid requires Ruby version >= 2.6.0. The current ruby version is 2.6.0.rc1. An error occurred while installing globalid (0.5.1), and Bundler cannot continue. Make sure that `gem install globalid -v '0.5.1' --source 'https://rubygems.org/'` succeeds before bundling. In Gemfile: rails was resolved to 5.2.6, which depends on actionmailer was resolved to 5.2.6, which depends on activejob was resolved to 5.2.6, which depends on globalid Build step 'Execute shell' marked build as failure Finished: FAILURE
- Target version set to 4.1.4
The following patch fixes the issue. It avoids
Gem::RuntimeRequirementNotMetError by enforcing Bundler to install globalid 0.4.2 if Ruby version is < 2.6.0 (including Ruby 2.6.0-rc1 and 2.6.0-rc2 too).
diff --git a/Gemfile b/Gemfile index 984cc078a..8474da345 100644 --- a/Gemfile +++ b/Gemfile @@ -4,6 +4,7 @@ ruby '>= 2.5.0', '< 3.1.0' gem 'bundler', '>= 1.12.0' gem 'rails', '6.1.4' +gem 'globalid', '~> 0.4.2' if Gem.ruby_version < Gem::Version.new('2.6.0') gem 'rouge', '~> 3.26.0' gem 'request_store', '~> 1.5.0' gem 'mini_mime', '~> 1.1.0'