Project

cmpfs-ruby

0.0
Low commit activity in last 3 years
A long-lived project that still receives updates
Compare File-System entities, for Ruby is a library that provides comparison functions for file-system entities - files and streams - including binary and filtering textual comparisons.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

>= 0.39.5, < 1.0
 Project Readme

cmpfs.Ruby

Compare File-System entities, for Ruby

Language License Gem Version Last Commit Ruby

Table of Contents

  • Introduction
  • Installation
  • Components
  • Examples
  • Project Information
    • Where to get help
    • Contribution guidelines
    • Dependencies
      • Efferent (fan-out)
        • Runtime Dependencies (aka "Normal Dependencies")
        • Development Dependencies
      • Afferent (fan-in)
        • Runtime dependents
        • Development dependents
    • Related projects
    • License

Introduction

cmpfs.Ruby provides platform-independent facilities for comparing file contents, for both binary and text files.

It has no dependencies on any other non-standard library.

Installation

Install via gem as in:

gem install cmpfs-ruby

or add it to your Gemfile.

Use via require, as in:

require 'cmpfs'

Components

The primary components provided are the functions:

  • CmpFS::Compare.compare_binary_files()
  • CmpFS::Compare.compare_binary_streams()
  • CmpFS::Compare.compare_binary()
  • CmpFS::Compare.compare_text_files()
  • CmpFS::Compare.compare_text_streams()
  • CmpFS::Compare.compare_text()

all of which are obtained when extending or includeing the CmpFS module.

Examples

Examples are provided in the examples directory, along with a markdown description for each. A detailed list TOC of them is provided in EXAMPLES.md.

examples/compare_two_binary_files.rb:

#! /usr/bin/env ruby

$:.unshift File.join(File.dirname(__FILE__), '../lib')


require 'cmpfs'


include CmpFS


# command-line handling

lhs_path, rhs_path =
case ARGV.size
when 0, 1

  if '--help' == ARGV[0]

    $stdout.puts "#$0: <lhs-path> <rhs-path>"

    exit 0
  end

  abort "#$0: not enough arguments; use --help for usage"
when 2

  ARGV[0..2]
else

  abort "#$0: too many arguments; use --help for usage"
end


# main()


$stdout.puts "binary comparison of '#{lhs_path}' with '#{rhs_path}':"

$stdout.puts "files are #{compare_binary(lhs_path, rhs_path) ? '' : 'not '}equal"


# ############################## end of file ############################# #

examples/compare_two_text_files.rb:

#! /usr/bin/env ruby

$:.unshift File.join(File.dirname(__FILE__), '../lib')


require 'cmpfs'


include CmpFS


# command-line handling

lhs_path, rhs_path =
case ARGV.size
when 0, 1

  if '--help' == ARGV[0]

    $stdout.puts "#$0: <lhs-path> <rhs-path>"

    exit 0
  end

  abort "#$0: not enough arguments; use --help for usage"
when 2

  ARGV[0..2]
else

  abort "#$0: too many arguments; use --help for usage"
end


# main()


$stdout.puts "text comparison of '#{lhs_path}' with '#{rhs_path}':"

$stdout.puts "files are #{compare_text(lhs_path, rhs_path, skip_blank_lines: true, trim_lines: true) ? '' : 'not '}equal"


# ############################## end of file ############################# #

Project Information

Where to get help

GitHub Page

Contribution guidelines

Defect reports, feature requests, and pull requests are welcome on https://github.com/synesissoftware/cmpfs.Ruby.

Dependencies

Efferent (fan-out)

Libraries upon which cmpfs.Ruby depends:

Runtime Dependencies (aka "Normal Dependencies")
  • <none>;
Development Dependencies

Afferent (fan-in)

Projects that depend on cmpfs.Ruby:

Runtime dependents
  • <none>;
Development dependents
  • <none>;

Related projects

  • C/C++ cmpfs — same product idea (binary/text file and stream comparison); recovery into freelibs is planned beside this gem (not yet published as a sibling tree here);

License

cmpfs.Ruby is released under the 3-clause BSD license. See LICENSE for details.