$ show postmodern/ruby-install
This is a CLI tool for installing multiple Ruby implementations (CRuby, JRuby, TruffleRuby, mruby) from source. It auto-detects the operating system, package manager, and downloader, then downloads, verifies checksums, applies patches, compiles, and installs the Ruby. The architecture is a collection of sourced bash scripts organized into a plugin system: each Ruby implementation has its own `functions.sh` and `dependencies.sh` that override generic steps. The main entry point is `bin/ruby-install`, which orchestrates the process using utility functions from `share/ruby-install/`. The codebase is well-structured with extensive test coverage using shunit2, and follows a strict coding style. It does not handle data pipelines or analytics; it is purely a system administration tool.
The LLM identified 3 files worth highlighting for reuse:
Provides a generic checksum verification framework supporting MD5, SHA1, SHA256, SHA512. It auto-detects the available checksum utility (md5sum, sha1sum, etc.) and provides `lookup_checksum`, `compute_checksum`, and `verify_checksum` functions. These functions are self-contained, well-documented, and could be extracted into any bash project that needs file integrity verification. The pattern demonstrates robust handling of multiple tools and error states.
Contains generic utility functions: `absolute_path`, `check_write_permissions`, `download`, `extract`, and `copy_into`. These are independent of ruby-install logic and can be reused in any bash project. The `download` function handles both `wget` and `curl`, supports resume, and moves `.part` files atomically. `extract` handles multiple archive formats with fallback for `.tar.xz`. The functions are well-parameterized and demonstrate good error handling.
Implements version matching logic: `is_known_version` checks if a version exists in a file, `latest_version` finds the latest matching version from a stable list. This is a clean, reusable pattern for any tool that needs to version-resolve against a list. It is simple, well-tested, and could be used in other version-management scripts.