ruby - 显示 gem 依赖项的命令?

标签 ruby rubygems

是否有一个命令可以告诉您一个 gem 所依赖的其他 gem?

另外,有没有办法自动安装 gem 的依赖项?

最佳答案

以下信息是从下面链接的 ruby​​gems 命令引用中提取的。

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/

相关文章:

ruby - 为什么三元语法在这种情况下不起作用?

ruby-on-rails - 在 ruby​​ 2.0.0p247 上安装 ruby​​-debug-base 时出错

ruby-on-rails - 从 Gem 获取 Ruby 项目根路径

ruby - 无法安装 charlock holmes gem,已安装 libicu-devel

ruby-on-rails - 这两个 'belongs_to' 语句之间有什么区别吗

ruby - 识别哪个 sidekiq 进程属于哪个应用程序

ruby-on-rails - 当 gemspec 声明开放约束时,为什么 bundler 坚持使用确切的 gem 版本号?

ruby-on-rails - 如何部署我的应用程序可以访问但其他人无法获取的 'private' gem?

ruby - 对数组中的特定对象进行排序

ruby-on-rails - Ruby on Rails 中的多对多多态关联