Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
687 views
in Technique[技术] by (71.8m points)

ruby - Command for displaying a gem's dependencies?

Is there a command that tells you the other gems that a gem depends on?

Also, is there a way to auto install the gem's dependencies?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The following information was pulled from the rubygems command reference linked below.

http://guides.rubygems.org/command-reference/#gem-dependency

The first command you're asking for is "gem dependency". Below is the command description.

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

The second command you'll need is "gem install". Dependencies get installed automatically. Read the quote below from the command reference for more detail.

"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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...