$ show AssetSync/asset_sync
AssetSync is a Ruby gem that synchronizes compiled assets from a Rails (or Rack) application to cloud storage providers such as AWS S3, Rackspace Cloud Files, Google Cloud Storage, Azure Blob, and Backblaze B2. It hooks into the Rails asset pipeline by enhancing the `assets:precompile` Rake task, automatically uploading assets after compilation. The gem supports incremental uploads (uploading only new or changed files), optional deletion of obsolete remote files, gzip/brotli compression, concurrent uploads, CDN invalidation, and caching of remote file lists for performance. Configuration is flexible via Rails initializer, YAML file, or environment variables. The codebase is well-structured with a clear separation of concerns (`Config`, `Storage`, `MultiMime`), comprehensive unit and integration tests, and support for multiple Rails versions (6.1 through 8.1) and Ruby versions (3.0+). It is actively maintained with recent releases and zero Dependabot alerts.
The LLM identified 2 files worth highlighting for reuse:
The `Config` class is a well-encapsulated configuration manager that uses ActiveModel::Validations to enforce required fields and conditional validation based on the storage provider (AWS, Rackspace, Google, Azure, Backblaze). It also generates the provider-specific fog options hash, handles YAML loading with ERB, and provides domain-specific helpers (e.g., `aws?`, `google_service_account?`). The inner classes `FileExtToMimeTypeOverrides` and `FogPublicValue` demonstrate clean internal design. This component could be extracted as a standalone configuration library for gems that need provider-agnostic cloud storage settings.
A small but reusable utility for looking up MIME types by file extension, with fallback across MIME::Types, Mime::Type, and Rack::Mime. It also supports overriding MIME types (e.g., forcing `application/javascript` for `.js`). The pattern of trying multiple libraries in order is a clean example of graceful degradation that could be reused in any Ruby project needing cross-platform MIME detection.