在 Rails Gemfile 中指定多个 gem 约束的语法是什么?

What is the syntax to specifing multiple gem constraints in a Rails Gemfile?

多重依赖的 Gemfile 的正确语法是什么?

尝试使用 Capistrano 时,我收到一条错误消息:

cap aborted!
NotImplementedError: unsupported key type `ssh-ed25519'
net-ssh requires the following gems for ed25519 support:
 * rbnacl (>= 3.2, < 5.0)
 * rbnacl-libsodium, if your system doesn't have libsodium installed.
 * bcrypt_pbkdf (>= 1.0, < 2.0)
See https://github.com/net-ssh/net-ssh/issues/478 for more information
Gem::LoadError : "can't activate rbnacl (< 5.0, >= 3.2.0), already activated rbnacl-5.0.0. Make sure all dependencies are added to Gemfile."

我将以下内容放入我的 Gemfile 中:

gem 'rbnacl', '>= 3.2, < 5.0', :require => false
gem 'rbnacl-libsodium', :require => false
gem 'bcrypt_pbkdf', '>= 1.0, < 2.0', :require => false

gems(和 req false)之前在 Gemfile 中。

当我添加版本要求时,bundle install 出现以下错误:

[!] There was an error parsing `Gemfile`: Illformed requirement [">= 3.2, < 5.0"]. Bundler cannot continue.

 #  from /Users/myname/MySite/Gemfile:70
 #  -------------------------------------------
 #    gem 'capistrano-maintenance', '~> 1.0', :require => false
 >    gem 'rbnacl', '>= 3.2, < 5.0', :require => false
 #    gem 'rbnacl-libsodium', :require => false
 #  -------------------------------------------

使用数组或直接列出来:

gem 'rbnacl', ['>= 3.2', '< 5.0']
gem 'bcrypt_pbkdf', '>= 1.0', '< 2.0'
gem install 'rbnacl:<5.0' rbnacl-libsodium 'bcrypt_pbkdf:<2.0'