简体   繁体   中英

Automatically using the latest patch version of Ruby on Heroku

I recently updated my application to Rails 6, and would like Heroku to automatically use the latest patch version of Ruby (ie 2.6.x) when I deploy. According to the Heroku documentation , I should be able to do this by specifying ruby '~> 2.6.0 in my Gemfile, but I still receive this message on deploy:

在此处输入图片说明

Here are the top lines of my Gemfile:

# frozen_string_literal: true

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '~> 2.6.4'

With everything I've tried Heroku still locks me to ruby-2.6.4 (" Using Ruby version: ruby-2.6.4 ") and throws the warning above. I've tried:

  • Removing my .ruby-version file (it's now gone).
  • Changing the ruby version in my Gemfile to ruby ~> 2.6.0 .

Any help would be appreciated!

You already linked this document: https://devcenter.heroku.com/articles/ruby-versions#ruby-version-specifiers

If you want to install exactly ruby 2.6.5 you need to write:

ruby "2.6.5"

I recently updated my application to Rails 6, and would like Heroku to automatically use the latest patch version of Ruby (ie 2.6.x) when I deploy. According to the Heroku documentation, I should be able to do this by specifying ruby '~> 2.6.0 in my Gemfile , but I still receive this message on deploy

That's a misunderstanding. It does not say it will use the latest version of Ruby 2.6.x.

You can put this there:

ruby '~> 2.6.5'

This will install ruby version 2.6.5 or higher. This is something that you have to manually increase. But generally if it works for a lesser version you should still allow them.

Don't use pragmatic versioning for Ruby.

Having Ruby automatically upgrade to the latest minor version seems like a good idea when viewed naively but in real life it should make you very nervous. Software is imperfect and even software that closely follows semantical versioning could potentially break your application as software is written by humans.

You want to test, develop and deploy on the exact same version of Ruby down to the patch-level. Use a fixed version constraint.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM