3
votes

I'm aware of gem dependency as a means to investigate a dependency graph, but I'm looking for something a little more straightforward. I only want to list gems that aren't dependencies of other gems.

In Homebrew, you can accomplish something similar with brew leaves - this lists packages that aren't dependencies of other packages. I mention this in case it's helpful in understanding what I'm trying to accomplish.

2

2 Answers

4
votes

I've made a small shell script for that:

#!/bin/sh

GEMS_FILE=`mktemp`
DEPENDENCIES_FILE=`mktemp`

gem list -l | sed 's/ (.*//' | sort > $GEMS_FILE
cat $GEMS_FILE | xargs -n1 gem dependency -l --pipe | sed 's/ --version.*//' | sort -u > $DEPENDENCIES_FILE
comm -23 $GEMS_FILE $DEPENDENCIES_FILE
rm -f $GEMS_FILE $DEPENDENCIES_FILE

Also in a Gist form: https://gist.github.com/astyagun/290b783045afffb8190a0c75ab76d0fa

0
votes

Sounds like you're looking for the gem list command.

If you're looking for gem help you can just run gem --help.