Notes to self

gem-compare goes 1.0

It took forever, but gem-compare hits 1.0!

What is gem-compare, you ask? gem-compare is a RubyGems plugin that can compare gem versions. I originally created it to vet new gem versions I packaged for Fedora, but it’s useful for all kinds of tasks. The main use-cases for gem-compare are:

  • checking accidental permission changes
  • checking for files that shouldn’t make the release
  • checking for unwanted dependency changes
  • tracking license changes
  • reviewing new code

Have you heard about the npm package that wiped out people’s disk space based on geolocation? gem-compare can help you prevent bad upgrades in the Ruby eco-system.

Usage

After installation (that needs curl header files), you can start comparing:

$ gem install gem-compare
$ gem compare rails 6.2.0 7.0.0 -k

The -k option will keep the gem files if you need to work with them.

By default all kinds of comparisons are run, but you can specify what you need:

$ gem compare --help
Usage: gem compare GEMNAME VERSION [VERSION ...] [options]

  Options:
    -a, --all                        Show every comparison
    -k, --keep-all                   Keep downloaded and extracted gem files
    -n, --no-color                   Do not colorize output
        --platform PLATFORM          Specify the platform of gem to compare
    -p, --param PARAM                Compare only a given paramater
    -r, --runtime                    Compare only runtime dependencies
    -d, --development                Compare only development dependencies
    -f, --files                      Compare only files for runtime
    -F, --diff                       Diff file contents
    -g, --gemfiles                   Compare only Gemfiles
    -b, --brief                      Include only important changes in the report
    -s, --sources SOURCES            Use different source URIs for gems (separated by comma)

Note that you can compare as many versions at once as you want.

What’s new

gem-compare stayed long time at 0.0.7, but last weekend I updated the project for RubyGems 3.x and finally released 1.0. And that’s not everything, because 1.0 brings a nice new feature which I want to highlight.

It’s now possible to compare whole file diffs with the --diff option:

diff-feature

GitHub

So go ahead and make gem-compare part of your release and upgrade workflows :). Contributions welcome.

Work with me

I have some availability for contract work. I can be your fractional CTO, a Ruby on Rails engineer, or consultant. Write me at strzibny@strzibny.name.

RSS