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?
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.
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With