whatthegem
whatthegem copied to clipboard
Ruby gem information, stats and usage for your terminal
whatthegem
is a small utility to answer some questions about Ruby gems you work with or planning to work with.
It tries to answer—right in your terminal—questions like the following:
- Colleague added
gemname
to ourGemfile
, what is it? - How outdated is my favorite
gemname
I am using locally, what's changed since then? - What's that benchmarking
gemname
's synopsis was, again? - There is
gemname
advised on the internetz for my problem, is it still maintained? Is it widely used?
There are a lot of ways to answer those questions through Google and various sites, but if you are in a terminal currently, whatthegem
is fastest, most focused and convenient.
Showcase:
gem install whatthegem
whatthegem <gem> info
Just extracts gem's description and version from RubyGems.org and presents it to you alongside your local versions.
whatthegem <gem> usage
Tries to parse gem's GitHub README (or local README, if the gem is installed and includes it), and extract Ruby code blocks from there (except trivial, like "Add to your Gemfile
: gem 'gemname'
) and prints them. Typically, it is the main/most basic usage examples.
whatthegem <gem> changes
Parses gem's GitHub Changelog.md
/NEWS
/History
, or GitHub releases description, and lists versions and their changes (up to your local version, if it is older than recent one).
whatthegem <gem> stats
Some statistics about gem's maintenance, freshness, and popularity (again, from RubyGems.org and GitHub). It doesn't judge, just provides helpful quick insights.
Note that, for example, "not having a new version in last year or two" doesn't necessary means the gem is abandoned, it could be just "complete".
This functionality is ported from my earlier gem any_good—after its creation, I eventually understood there are several things I'd like to be able to know about the gems, and so whatthegem was born.
Limitations
- As significant amount of information is taken from GitHub,
whatthegem
is less useful for gems that aren't on GitHub, or doesn't specify their repo URL in gemspec (available via RubyGems.org API); integrating of other source hosting is possible, but currently, in my experience, it seems like ~99% of gems are there; - Also, GitHub usage/changes extraction for gems that aren't in the root of the repo (like ActiveRecord) aren't supported yet;
- As
usage
andchanges
are extracted by heuristics, it doesn't always work well (though it does in a surprisingly large number of cases);- For example,
usage
is typically informative for stand-alone libraries, but hardly so for Rails plugins (which have instructions like "run this generator, add that to config, insert this line in the model" in their README) - For other, not all gems have their Changelog findable, or parseable.
- For example,