Skip to content

stringsn88keys/diff_gem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Diff Gem

Compare the source code and metadata between two versions of a Ruby gem.

Installation

gem install diff_gem

Or install locally:

gem build diff_gem.gemspec
gem install diff_gem-0.1.0.gem

Usage

Compare Source Code

Compare two versions of a gem:

diff_gem GEM_NAME OLD_VERSION NEW_VERSION

Example:

diff_gem rails 7.0.0 7.0.1

Or use the explicit command:

diff_gem compare rails 7.0.0 7.0.1

Compare Metadata

Compare gem metadata (dependencies, version info, file counts, etc.) without comparing source:

diff_gem metadata rails 7.0.0 7.0.1

Compare Both

Compare metadata and source code together:

diff_gem compare --metadata rails 7.0.0 7.0.1

Cache Management

View cache information:

diff_gem cache info

Clear the cache:

diff_gem cache clear

Custom Cache Directory

You can specify a custom cache directory:

diff_gem --cache-dir /tmp/gem_cache rails 7.0.0 7.0.1

Or set the environment variable:

export DIFF_GEM_CACHE_DIR=/tmp/gem_cache
diff_gem rails 7.0.0 7.0.1

How It Works

Source Comparison:

  1. Downloads both gem versions from rubygems.org
  2. Extracts the gem source code to a cache directory
  3. Runs diff -r -u -N to compare the source trees
  4. Displays the unified diff output

Metadata Comparison:

  1. Downloads gem metadata from rubygems.org
  2. Extracts and parses the gemspec information
  3. Compares dependencies, file counts, version requirements, and other metadata
  4. Displays a structured comparison showing added, removed, and changed fields

Downloaded gems are cached in ~/.diff_gem_cache by default, so subsequent comparisons are faster.

Similar Tools

If diff_gem doesn't meet your needs, you might want to check out these alternatives:

  • gemdiff - Compare gem versions with GitHub integration, showing commits between releases and opening diffs in the browser
  • gem-compare - Another tool for comparing gem versions with a focus on simplicity

diff_gem focuses on providing both detailed source code diffs and comprehensive metadata comparisons in a command-line interface.

License

MIT

About

A Ruby Gem to diff gems by source and metadata from gem files

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published