`os_info` is a Rust workspace containing a library and a small CLI for detecting the host operating system's type, version, edition, codename, bitness, and processor architecture. The public entry point is `os_info::get()`, which dispatches through `cfg`-selected platform modules (`imp::current_platform`) for AIX, Android, Cygwin, DragonFly, Emscripten, FreeBSD, Hurd, illumos, iOS, Linux, macOS, NetBSD, OpenBSD, Redox, Windows, and unknown targets. Linux detection tries `lsb_release` output first, then scans release files through a table-driven parser; macOS reads `SystemVersion.plist` via Objective-C bindings and falls back to `sw_vers`; Windows uses the registry and dynamically loaded `RtlGetVersion`; the BSDs and other Unix-likes rely on `uname` plus platform commands like `sysctl`, `isainfo`, or `prtconf`. The CLI binary wraps this with clap flags for full or partial output. Architecturally, the workspace is clean: platform details are isolated behind a single `current_platform()` function, shared utilities (`matcher`, `uname`, `version`) are small and testable, and public types are documented with optional serde and JSON-schema support. The crate is unusually well tested for its domain: each platform module has unit tests, Linux detection is backed by a corpus of real `/etc/os-release` fixtures for dozens of distributions, and CI enforces formatting, clippy, dead links, spellcheck, dependency licensing, semver checks, and coverage. Unsafe code is denied at the crate level and confined to deliberate FFI modules. Overall, this is a mature, actively maintained system utility rather than an application service or data pipeline. It does not expose endpoints or store data; its value is as a reusable dependency and reference implementation for reliable cross-platform OS introspection.
Specinfra is a Ruby library that provides a common abstraction layer for infrastructure testing tools like Serverspec and Itamae. It defines a unified API for running commands on remote or local systems, detecting the target OS, and generating OS-specific shell commands for checking system resources such as packages, services, files, ports, users, and more. The library supports multiple backends including local execution (Exec), SSH, Docker (via docker-api and CLI), LXC, LXD, WinRM, Telnet, and others, making it suitable for testing a wide variety of environments from bare metal to containers and cloud instances. The architecture is built around three core concepts: backends that handle command execution, commands that generate the appropriate shell commands for a given OS and resource type, and a processor that implements higher-level checks (e.g., whether a service is running, whether a file is mounted with specific options). OS detection is handled by a set of detectors that probe the target system and determine the family, release, and architecture. A command factory dynamically resolves the correct command class based on the OS info, allowing seamless support for over 20 Linux distributions plus BSD, macOS, Solaris, AIX, and Windows. While the codebase is mature and well-structured with clear separation of concerns, it is tightly coupled to the Serverspec/Itamae ecosystem and uses global configuration and singleton patterns. The command modules for service management (systemd, init, OpenRC, etc.) and port checking (using ss) are cleanly extracted as Ruby mixins and could be reused in other projects with minimal adaptation. The library is actively maintained, supports Ruby versions from 2.3 to 3.4, and has a comprehensive test suite covering command generation and OS detection.