Project

diffoscope

0.0
No release in over 3 years
Compare files, URLs, or package URLs using diffoscope
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

>= 1.7.0
 Project Readme

Diffoscope

Gem Version

Ruby bindings for diffoscope, a tool for in-depth comparison of files, archives, and directories.

Installation

Requires diffoscope to be installed. See their website for installation options (pip, apt, brew, etc).

Then install the gem:

gem install diffoscope

Or add to your Gemfile:

gem 'diffoscope'

Docker

To avoid installing diffoscope locally:

docker build -t diffoscope .

# Compare URLs
docker run --rm diffoscope https://example.com/file1.tar.gz https://example.com/file2.tar.gz

# Compare local files (mount current directory)
docker run --rm -v "$(pwd):/data" -w /data diffoscope file1.tar.gz file2.tar.gz

Usage

Ruby API

require 'diffoscope'

# Compare local files
result = Diffoscope.compare("old.tar.gz", "new.tar.gz")

# Compare URLs
result = Diffoscope.compare("https://example.com/pkg-1.0.tar.gz", "https://example.com/pkg-1.1.tar.gz")

# Compare package URLs
result = Diffoscope.compare("pkg:gem/rails@7.0.0", "pkg:gem/rails@7.1.0")

# Check results
result.identical?        # => true/false
result.to_unified_diff   # => git-style diff string
result.to_h              # => raw diffoscope hash
result.sha256_1          # => SHA256 of first file
result.sha256_2          # => SHA256 of second file

CLI

diffoscope old.tar.gz new.tar.gz
diffoscope --json old.tar.gz new.tar.gz
diffoscope pkg:gem/rails@7.0.0 pkg:gem/rails@7.1.0
diffoscope --check  # verify diffoscope is installed

License

GPL-3.0-or-later