New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cmpfs-ruby

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cmpfs-ruby

  • 0.2.3
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

cmpfs.Ruby

Compare File-System entities, for Ruby

Gem Version

Introduction

Provides platform-independent facilities for comparing file contents, for both binary and text files

Table of Contents

Installation

Install using gem install cmpfs-ruby or add it to your Gemfile.

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/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

T.B.C.

License

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

FAQs

Package last updated on 03 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc