metacrunch
metacrunch 5 is not released yet.
masterholds the 5.x line under development. The released version on RubyGems is metacrunch 4.2.1; its code is in the branch4.x.
metacrunch is a small toolkit for data processing and ETL (extract, transform, load) in Ruby. A job reads records from a source, passes them through steps and writes the results to a sink.
This repository holds metacrunch and its extension gems. Start with metacrunch's Readme.
Gems
| Gem | Directory | What it does |
|---|---|---|
metacrunch |
metacrunch/ |
jobs, sources, steps, sinks, projects and the command line; JSON Lines |
metacrunch-csv |
metacrunch-csv/ |
a source and a sink for CSV |
metacrunch-xlsx |
metacrunch-xlsx/ |
a source and a sink for Excel files |
metacrunch-marc |
metacrunch-marc/ |
MARCXML, binary MARC (ISO 2709) and MARC-in-JSON on one record model |
metacrunch-elasticsearch |
metacrunch-elasticsearch/ |
a source, a bulk sink and index commands for Elasticsearch 8 and 9 |
metacrunch-db |
metacrunch-db/ |
a source and a sink for SQLite, PostgreSQL, MySQL and MariaDB |
metacrunch-redis |
metacrunch-redis/ |
a queue between jobs, and a source and a sink for keys, on Redis and Valkey |
Installation
Until metacrunch 5 is released, the gems come from Git with Bundler. Name the gems you need:
# Gemfile
git "https://github.com/ubpb/metacrunch.git" do
gem "metacrunch"
gem "metacrunch-csv"
endAll gems require Ruby 4.0.
Versioning
All gems share one version, and each extension gem requires metacrunch in exactly its own version: metacrunch-csv
5.1.0 requires metacrunch 5.1.0. The version is in the file VERSION in the root.
To change it, edit VERSION and run bundle exec rake version. The task writes the version into the version.rb of
every gem, since an installed gem holds only its own directory, and updates the lockfiles. The tooling test fails
while a gem has a version other than the one in VERSION.
A release tags the repository once (v5.1.0) and publishes every gem, also one without changes; its CHANGELOG then
says No changes. Each gem keeps its CHANGELOG in its directory.
Development
AGENTS.md describes how changes are designed, made and reviewed, for people and coding agents alike.
Each gem has a bundle of its own; the root's bundle holds the tooling. In the root:
$ bundle install
$ bundle exec rake bundle # bundle install in every gem
$ bundle exec rake # all tests and RuboCop: the tooling, then every gem
$ bundle exec rake version # write VERSION into every gem and update their lockfiles
One gem alone:
$ cd metacrunch-csv
$ bundle exec rake # its tests and RuboCop
Run RuboCop through these tasks: bundle exec rubocop in the root would check the gems with the root's bundle instead
of their own.
The lockfiles are committed, and CI installs them frozen. Every gem's lockfile records metacrunch as a path gem, so a
changed dependency in a gemspec, above all in metacrunch's, changes the lockfiles of the gems that load it: run
bundle exec rake bundle and commit every changed Gemfile.lock.
A gem may have further Gemfiles in gemfiles/: metacrunch-elasticsearch tests the client for Elasticsearch 8 with
gemfiles/elasticsearch_8.gemfile, metacrunch-db the drivers for MySQL and MariaDB with gemfiles/mysql.gemfile
(mysql2 needs the MySQL client library). rake bundle, rake test and rake version take them along; Dependabot
updates only Gemfile.lock, so after its updates bundle exec rake bundle brings the further lockfiles up to date.
Gems that talk to a server, such as metacrunch-elasticsearch, metacrunch-db and metacrunch-redis, have integration
tests that need the server: the gem's test/compose.yml starts it with Docker, and the gem's Readme shows how to run
them. Without the server they are skipped. AGENTS.md says when they have to run before a merge.
License
MIT. Each gem has its own License.txt; the root's License.txt is metacrunch's.