Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Command for displaying a gem's dependencies?

Tags:

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?

like image 237
keruilin Avatar asked Oct 29 '10 21:10

keruilin


People also ask

How do I check gem dependencies?

You can always check the reverse dependencies of a gem on rubygems.org. There's a link on the right side panel on the website.

What is gem install command?

The install command installs local or remote gem into a gem repository. For gems with executables ruby installs a wrapper file into the executable directory by default.

How do you check if a gem is installed?

Since your goal is to verify a gem is installed with the correct version, use gem list . You can limit to the specific gem by using gem list data_mapper . To verify that it's installed and working, you'll have to try to require the gem and then use it in your code.

What is gem in command line?

The gem command allows you to interact with RubyGems. Ruby 1.9 and newer ships with RubyGems built-in but you may need to upgrade for bug fixes or new features. To upgrade RubyGems, visit the download page. If you want to see how to require files from a gem, skip ahead to What is a gem.


Video Answer


1 Answers

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.

like image 75
Thomas Langston Avatar answered Oct 23 '22 07:10

Thomas Langston