Compare the source code and metadata between two versions of a Ruby gem.
gem install diff_gemOr install locally:
gem build diff_gem.gemspec
gem install diff_gem-0.1.0.gemCompare two versions of a gem:
diff_gem GEM_NAME OLD_VERSION NEW_VERSIONExample:
diff_gem rails 7.0.0 7.0.1Or use the explicit command:
diff_gem compare rails 7.0.0 7.0.1Compare gem metadata (dependencies, version info, file counts, etc.) without comparing source:
diff_gem metadata rails 7.0.0 7.0.1Compare metadata and source code together:
diff_gem compare --metadata rails 7.0.0 7.0.1View cache information:
diff_gem cache infoClear the cache:
diff_gem cache clearYou can specify a custom cache directory:
diff_gem --cache-dir /tmp/gem_cache rails 7.0.0 7.0.1Or set the environment variable:
export DIFF_GEM_CACHE_DIR=/tmp/gem_cache
diff_gem rails 7.0.0 7.0.1Source Comparison:
- Downloads both gem versions from rubygems.org
- Extracts the gem source code to a cache directory
- Runs
diff -r -u -Nto compare the source trees - Displays the unified diff output
Metadata Comparison:
- Downloads gem metadata from rubygems.org
- Extracts and parses the gemspec information
- Compares dependencies, file counts, version requirements, and other metadata
- 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.
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.
MIT