是否有一个命令可以告诉您一个 gem 所依赖的其他 gem?
另外,有没有办法自动安装 gem 的依赖项?
最佳答案
以下信息是从下面链接的 rubygems 命令引用中提取的。
http://guides.rubygems.org/command-reference/#gem-dependency
您要求的第一个命令是“gem dependency”。下面是命令说明。
gem dependency GEMNAME [options]
Options:
-v, --version VERSION Specify version of gem to uninstall
-r, --[no-]reverse-dependencies Include reverse dependencies in the output
-p, --pipe Pipe Format (name --version ver)
Common Options:
--source URL Use URL as the remote source for gems
-h, --help Get help on this command
--config-file FILE Use this config file instead of default
--backtrace Show stack backtrace on errors
--debug Turn on Ruby debugging
Arguments:
GEMNAME name of gems to show
Summary:
Show the dependencies of an installed gem
Defaults:
--version '> 0' --no-reverse
您需要的第二个命令是“gem install”。依赖项会自动安装。阅读命令引用中的以下引述以获取更多详细信息。
"gem install" will install the named gem. It will attempt a local installation (i.e. a .gem file in the current directory), and if that fails, it will attempt to download and install the most recent version of the gem you want.
If a gem is being installed remotely, and it depends on other gems that are not installed, then gem will download and install those, after you have confirmed the operation.
关于ruby - 显示 gem 依赖项的命令?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4056067/