[ACCEPTED]-Command for displaying a gem's dependencies?-rubygems

Accepted answer
Score: 36

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

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

The 16 first command you're asking for is "gem 15 dependency". Below is the command 14 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 13 is "gem install". Dependencies 12 get installed automatically. Read the quote 11 below from the command reference for more 10 detail.

"gem install" will install 9 the named gem. It will attempt a local installation 8 (i.e. a .gem file in the current directory), and 7 if that fails, it will attempt to download 6 and install the most recent version of 5 the gem you want.

If a gem is being installed 4 remotely, and it depends on other gems 3 that are not installed, then gem will 2 download and install those, after you 1 have confirmed the operation.

Score: 1

To find out about a locally installed gem:

$ gem dependency /^rails$/
Gem rails-4.0.12
  actionmailer (= 4.0.12)
  actionpack (= 4.0.12)
  activerecord (= 4.0.12)
  activesupport (= 4.0.12)
  bundler (>= 1.3.0, < 2.0)
  railties (= 4.0.12)
  sprockets-rails (~> 2.0)
...

For 3 an arbitrary gem:

$ gem dependency -rv 4.2.7 /^rails$/
Gem rails-4.2.7
  actionmailer (= 4.2.7)
  actionpack (= 4.2.7)
  actionview (= 4.2.7)
  activejob (= 4.2.7)
  activemodel (= 4.2.7)
  activerecord (= 4.2.7)
  activesupport (= 4.2.7)
  bundler (>= 1.3.0, < 2.0)
  railties (= 4.2.7)
  sprockets-rails (>= 0)

-r stands for --remote, -v for --version. I'm 2 running rubygems-3.0.3. Starting with 3.1.0 you have to omit 1 the regex delimiters:

$ gem dependency -rv 4.2.7 ^rails$
...

More Related questions