$ show alexch/rerun
Rerun is a command-line utility that automatically restarts a program when relevant files in a watched directory change. It wraps the Listen gem to efficiently monitor the filesystem and supports graceful process termination via configurable signal sequences (default TERM, INT, KILL). The tool provides real-time keypress commands (restart, force restart, clear, pause, quit) and optional desktop notifications via growlnotify, terminal-notifier, or notify-send. The codebase is a single Ruby gem with a CLI entry point (bin/rerun) and a clear separation of concerns: Runner for process management, Watcher for filesystem listening, Options for CLI parsing, and Notification for cross-platform alerts. It was last actively developed around 2014-2018, with a documented version 0.14.0 in 2023, but open issues and pull requests from 2014 suggest it is no longer maintained.
The LLM identified 3 files worth highlighting for reuse:
Converts shell glob patterns (including **, *, ?, {}, and brace expansion) into Ruby regular expressions. This is a self-contained, well-tested module that could be extracted into a standalone gem. It handles edge cases like escaping, leading dots, and path separators correctly, and is used internally by the Watcher to filter files.
A tiny mixin providing OS detection methods (mac?, windows?, linux?) and a rails? check. Reusable across any Ruby project that needs to branch behavior based on platform. Simple, well-named, dependency-free.
Handles sending OS-level notifications by detecting available CLI tools (growlnotify, terminal-notifier, notify-send) and building the appropriate command string. It respects Bundler environment cleanup and supports fallback logic. This module is decoupled from the main Runner logic via an options hash and could be reused in any Ruby CLI tool seeking desktop alerts.