Contributing

Contribution to minitar is encouraged: bug reports, feature requests, or code contributions. There are a few DOs and DON’Ts that should be followed:

LLM-Generated Contribution Policy

minitar-cli accepts only issues or pull requests that are well understood by the submitter and that, especially for pull requests, the developer can attest to the Developer Certificate of Origin for each pull request (see LICENCE).

If LLM assistance is used in writing pull requests, this must be documented in the commit message and pull request. If there is evidence of LLM assistance without such declaration, the pull request will be declined.

Any contribution (bug, feature request, or pull request) that uses unreviewed LLM output will be rejected.

For an example of how this should be done, see #151 and its associated commits.

Test

minitar uses Ryan Davis’s [Hoe] to manage the release process, and it adds a number of rake tasks. You will mostly be interested in rake, which runs tests in the same way that rake test does.

To assist with the installation of the development dependencies for minitar, I have provided the simplest possible Gemfile pointing to the (generated) minitar.gemspec file. This will permit you to use bundle install to install the development dependencies.

You can run tests with code coverage analysis by running rake coverage.

Test Helpers

Minitar includes a number of custom test assertions, constants, and test utility methods that are useful for writing tests. These are maintained through modules defined in test/support.

Fixture Utilities

Minitar uses fixture tarballs in various tests, referenced by their base name (test/fixtures/tar_input.tar.gz becomes tar_input, etc.). There are two utility methods:

Header Assertions and Utilities

Tar headers need to be built and compared in an exacting way, even for tests.

There are two assertions:

expected must be a string representation of the expected header and this assertion calls to_s on the actual value so that both PosixHeader and PaxHeader instances are converted to string representations for comparison.

There are several other helper methods available for working with headers:

Tarball Helpers

Minitar has several complex assertions and utilities to work with both in-memory and on-disk tarballs. These work using two concepts, file hashes (file_hash) and workspaces (workspace).

File Hashes (file_hash)

Many of these consume or produce a file_hash, which is a hash of {filename => content} where the tarball will be produced with such that each entry in the file_hash becomes a file named filename with the data content.

As an example, Minitar::TestHelpers has a MIXED_FILENAME_SCENARIOS constant that is a file_hash:

MIXED_FILENAME_SCENARIOS = {
  "short.txt" => "short content",
  "medium_length_filename_under_100_chars.txt" => "medium content",
  "dir1/medium_filename.js" => "medium nested content",
  "#{"x" * 120}.txt" => "long content",
  "nested/dir/#{"y" * 110}.css" => "long nested content"
}.freeze

This will produce a tarball that looks like:

short.txt
medium_length_filename_under_100_chars.txt
dir1/medium_filename.js
x[118 more 'x' characters...]x
nested/dir/y[108 more y' characters...]y.css

Each file will contain the text as the content.

If the content is nil, this will be ignored for in-memory tarballs, but will be created as empty directory entries for on-disk tarballs.

Workspace (workspace)

A workspace is a temporary directory used for on-disk tests. It is created with the workspace utility method (see below) and must be passed a block where all setup and tests will be run.

At most one workspace may be used per test method.

Assertions

There are five assertions:

In-Memory Tarball Utilities
On-Disk Workspace Tarball Utilities

A workspace has a source directory, a target directory, and thetarball` which will be created from the prepared files.

All other utility methods must be run inside of a workspace block.

Workflow

Here’s the most direct way to get your work merged into the project: