$ show benpickles/parklife
Parklife is a Ruby library and CLI tool that converts Rack-based web applications (like Rails or Sinatra) into static HTML sites suitable for deployment on static hosting platforms (Netlify, Vercel, GitHub Pages, S3, etc.). It works by crawling the application's routes starting from defined entry points, making HTTP requests to each endpoint via Rack::Test, and saving the responses as appropriate files in a build directory. The library intelligently handles different HTTP response types through a responder pattern (200=OK, 304=NotModified, 404=NotFound, etc.), supports automatic link discovery and crawling from HTML responses, and provides flexible configuration for output formatting, caching via ETags, and 404 handling. Key features include route crawling with depth control, intelligent file naming logic (HTML vs other content types), and multiple reporter formats (progress dots, detailed logs, or silent).
The LLM identified 1 files worth highlighting for reuse:
A wrapper around Rack::Test that correctly sets HTTP headers (HTTP_HOST, HTTPS, SCRIPT_NAME) based on a configured base URL. This component isolates the complexity of making requests to Rack applications with proper host and port handling, including automatic port stripping for standard HTTP/HTTPS ports. It demonstrates careful attention to HTTP details that are critical for correctly simulating requests to a web application but easy to get wrong when manually constructing requests. The class is highly cohesive with a single responsibility and could be extracted into any project needing to interact with Rack apps programmatically.