最低 Ruby 版本的语法
Syntax for the minimum Ruby version
下面开始一个Gemfile
:
source "https://rubygems.org"
ruby "~> 2.4.5"
此方法基于答案
:
Already possible since Bundler 1.12, e.g.
ruby "~> 2.3.0"
我有 Bunder 的必要版本:
$ bundler -v
Bundler version 1.16.1
然而 运行 gem 给我们:
$ bundle exec rake db:create
Your Ruby version is 2.5.1, but your Gemfile specified ~> 2.4.5
rake
命令然后失败。我错过了什么?
~> x.y.z
表示 "x.y exactly, and any Z greater than or equal to z"。如果要允许 2.4+ 但不允许 3.0,请指定 ~> 2.4
.
下面开始一个Gemfile
:
source "https://rubygems.org"
ruby "~> 2.4.5"
此方法基于答案
Already possible since Bundler 1.12, e.g.
ruby "~> 2.3.0"
我有 Bunder 的必要版本:
$ bundler -v
Bundler version 1.16.1
然而 运行 gem 给我们:
$ bundle exec rake db:create
Your Ruby version is 2.5.1, but your Gemfile specified ~> 2.4.5
rake
命令然后失败。我错过了什么?
~> x.y.z
表示 "x.y exactly, and any Z greater than or equal to z"。如果要允许 2.4+ 但不允许 3.0,请指定 ~> 2.4
.