markevans/dragonfly
65.7
Adequate · 19 September 2026
3k
lines of production code
Ruby
primary language
1
measurement over time
What this system is
Dragonfly is a modular Ruby library for processing and serving images, built on a plugin-based architecture that integrates with ImageMagick. It provides a secure, configurable pipeline for fetching, analyzing, and transforming image assets, featuring robust model attachment handling for ActiveRecord and comprehensive URL generation with signature verification. The system supports various data stores and includes middleware for seamless integration into Rack and Rails applications.
How it got here
2009 — Rebranding to Dragonfly and v1.0 release
11 changes.
The project was rebranded from Imagetastic to Dragonfly, involving a comprehensive library rename and the modernization of its build and testing infrastructure. This period culminated in the v1.0.2 release, which introduced a major architectural overhaul to a modular, plugin-based system with enhanced security features and explicit Rails integration.
2011–2012 — Image processing refactoring and test expansion
13 changes.
This period focused on restructuring the ImageMagick plugin to replace deprecated commands with secure, dedicated processors for encoding and thumbnail generation. The model layer was simultaneously refactored to use a dedicated Attachment class and JSON serialization, while comprehensive test coverage was added for these behavioral changes and new Rails generator scaffolding.
2013 — modular architecture and test coverage
5 changes.
The project refactored core job processing logic into modular step components and standardized ImageMagick generators to improve code organization and maintainability. Comprehensive test suites were added for these new structures, including shared datastore specifications and detailed validation for job steps and image generation parameters.
Features
Added consistent signature generation for core types
Dragonfly now provides a \to\_dragonfly\_unique\_s\ method on \Object\, \Array\, and \Hash\ to generate consistent signatures. This allows these core Ruby types to be reliably converted into unique string representations, which is useful for caching or identifying content across different data structures.
_lib/dragonfly/core\ext · high confidence
New Rails generator for Dragonfly configuration
A new Rails generator has been added to scaffold the Dragonfly image processing setup. Running 'rails generate dragonfly' creates a new initializer file at config/initializers/dragonfly.rb. This generated configuration includes a secure, randomly generated secret key (using SecureRandom.hex) and protection against DoS attacks, ensuring the application is ready to serve images and other content out of the box.
lib/rails/generators/dragonfly · high confidence
New development environment for local testing and experimentation
A new \dev/\ directory has been added to provide tools for local testing and development of the library. This includes an \irbrc.rb\ configuration that sets up a Dragonfly app with ImageMagick and a sample Model for interactive testing, a \rails\_template.rb\ script to scaffold a Rails application with Dragonfly integration, and a \test.ru\ Rack application for quick image manipulation testing. A helper script \test\_rails\ automates the creation of a test Rails app using the template.
dev · high confidence
Removals
Removal of Imagetastic feature tests
The feature specification file (imagetastic.feature) and its corresponding step definitions (imagetastic\_steps.rb) have been deleted. This removes the associated test coverage for the 'imagetastic' functionality, indicating that this specific feature or its test suite is no longer part of the application.
features · high confidence
Removed Cucumber support environment file
The Cucumber feature test support file (env.rb) has been removed from the project. This file previously handled library loading and world object setup for Cucumber scenarios, indicating that Cucumber integration has been discontinued in favor of other testing approaches.
features/support · high confidence
Architecture
Refactored job steps into modular components
The job processing logic has been restructured by extracting individual operations into separate, dedicated files (Fetch, FetchFile, FetchUrl, Generate, Process) that inherit from a new Step base class. This change improves code organization and maintainability by isolating the responsibilities of fetching data from URLs or files, generating content, and processing assets, while the Step class provides a unified interface for job execution and argument handling.
lib/dragonfly/job · high confidence
Behavioural changes
8 commits (1 fix) modifying samples
A change to existing behaviour in samples — 8 commits (1 fix), 10 files.
samples · medium confidence · unverified
Dragonfly v1.0.2: Major API overhaul and security hardening
This release introduces a significant architectural shift for the Dragonfly image processing library, moving from a monolithic design to a modular, plugin-based system. The core API has been redesigned: configuration is now handled via a new \configure\ block with explicit \processor\, \analyser\, and \generator\ methods, replacing the previous implicit registration. A new \Job\ object model manages processing steps (fetch, process, generate) with lazy evaluation and serialization support (JSON Base64), replacing the older \TempObject\-centric workflow. Security is significantly improved by defaulting URL verification (\verify\_urls\) to true, requiring a secret for SHA signatures, and adding protection against malicious marshal deserialization. The library also drops support for Ruby versions older than 2.2, removes legacy URL formats by default, and introduces a \CookieMonster\ middleware for Rails to prevent cookie leakage in image responses.
lib/dragonfly · high confidence
ImageMagick plugin refactored with new analyzers and deprecated convert commands
The ImageMagick plugin has been restructured to improve security and usability. The previous 'convert' generator and processor are now deprecated and raise errors, encouraging users to use the new utility commands in Dragonfly::ImageMagick::Commands instead. A new 'image\_properties' analyzer has been added to extract format, width, and height, which powers new convenience analyzers for width, height, format, aspect\_ratio, portrait, landscape, and image detection. The plugin also introduces 'encode' and 'thumb' processors, and allows direct access to the ImageMagick 'identify' command via a new method.
_lib/dragonfly/image\magick · high confidence
Library renamed from Imagetastic to Dragonfly
The library has been renamed from Imagetastic to Dragonfly. The main entry point is now \lib/dragonfly.rb\, which replaces the deleted \lib/imagetastic.rb\. This change introduces the \Dragonfly\ module with methods for accessing app instances (\Dragonfly.app\, \Dragonfly\[\]\), detecting the Windows OS, and providing logging capabilities (\Dragonfly.logger\, \Dragonfly.debug\, etc.). It also registers default plugins (imagemagick) and datastores (file, memory) for configuration.
lib · high confidence
Project renamed to Dragonfly and build tooling modernized
The gem has been renamed from 'imagetastic' to 'Dragonfly', with the old README removed and a new one added. The build system has been modernized by replacing the Jeweler gem and manual RSpec/Cucumber Rake tasks with Bundler's gem tasks, and a new .rspec file enables colored output. CI is configured via .travis.yml to test against Ruby 2.2 through 3.0 and JRuby, and the .gitignore has been updated to exclude common build artifacts.
(repo-wide) · high confidence
Refactored ImageMagick generators to use a unified command-line interface
The ImageMagick generators (Plain, Plasma, and Text) have been rewritten to use a new \Commands.generate\ utility instead of the previous \convert\ generator. This change introduces stricter parameter validation for inputs like dimensions, colors, and font styles, and standardizes the URL attribute naming to \url\_attributes\. The Text generator now supports detailed CSS-style font properties (family, weight, style, stretch) and padding, while the Plain and Plasma generators provide simpler image generation with color and format options.
_lib/dragonfly/image\magick/generators · high confidence
Refactored ImageMagick processors with new Encode and Thumb implementations
The ImageMagick processing pipeline has been restructured to use dedicated processor classes for encoding and thumbnail generation. The new Encode processor handles image format conversion with whitelisted arguments (such as quality) and validates inputs. The Thumb processor now supports flexible geometry strings for resizing, cropping, and resized-cropping, including gravity-based alignment and frame selection. These changes replace previous ad-hoc configurations with a more robust, validated approach to image manipulation.
_lib/dragonfly/image\magick/processors · high confidence
Refactored model attachment handling and validation
The model layer has been restructured to use a dedicated \Attachment\ class that delegates operations to a \Job\, replacing the previous macro-based approach. This change introduces \xxx\_changed?\ and \xxx\_stored?\ methods for tracking attachment state, switches retained attribute serialization from Marshal to JSON base64 encoding, and replaces the deprecated \storage\_xxx\ configuration methods with a unified \storage\_options\ block. Additionally, validation errors during property analysis are now caught and logged as warnings rather than raising exceptions, and attachment destruction is handled via \after\_commit\ on destroy to ensure data consistency.
lib/dragonfly/model · high confidence
Removal of dragonfly/rails/images require path
Requiring 'dragonfly/rails/images' now raises a LoadError, directing users to use the 'rails generate dragonfly' command instead. This change removes the previous automatic configuration file in favor of a generator-based setup, ensuring a more explicit and customizable integration with Rails applications.
lib/dragonfly/rails · high confidence
Updated Rails generator initializer with new configuration and model integration
The Rails generator's initializer template has been updated to use the new \Dragonfly.app.configure\ block syntax, replacing previous methods. It now includes a generated secret for security, configures the ImageMagick plugin, sets up file-based data storage, and assigns the Rails logger. Additionally, it mounts the Dragonfly middleware and automatically extends ActiveRecord models with Dragonfly's model and validation functionality by default.
lib/rails/generators/dragonfly/templates · high confidence
Test coverage
Added functional tests for configuration, URL handling, and security; Added model integration tests for ActiveRecord and validations; Added shared datastore specification examples; Added test coverage for Dragonfly job steps; Added test coverage for ImageMagick encode and thumb processors; Added test coverage for ImageMagick generators; Added test fixtures for deprecated Marshal-based metadata; Added test support files and RSpec matchers; Added tests for Array and Hash to\_dragonfly\_unique\_s; Added tests for ImageMagick plugin commands, processors, and analyzers; Added tests for image property analysis and logging configuration; Initial test suite for Dragonfly core components.
Dependencies
Introduces Gemfile and updates gemspec for Ruby 4.0 compatibility
The project now includes a Gemfile to streamline development and testing setup, explicitly adding development dependencies like pry, rake, cgi, benchmark, and rdoc. The gemspec has been updated to declare runtime dependencies on rack (\>= 1.3), multi\_json (\~\> 1.0), addressable (\~\> 2.3), and ostruct (\~\> 0.6.1), while also adding development dependencies for rspec, webmock, and database adapters. These changes ensure compatibility with Ruby 4.0, where several standard library gems are no longer included by default.
(dependencies) · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Baseline
- First survey — no prior run to compare against. CAI 66.
Lenses
- Code Health 94
- Architecture 100
- Maturity 57
- Readiness 54
- Security 95
Changes since last survey
- 300 commits — 275 feature/other, 25 fixes
By area
- (root) — 109 commits
- lib/dragonfly — 100 commits
- spec/dragonfly — 39 commits
- (repo) — 33 commits
- lib/rails — 4 commits
- dev/rails_template.rb — 3 commits
- dev/irbrc.rb — 2 commits
- lib/dragonfly.rb — 2 commits
- spec/dragonfly_spec.rb — 2 commits
- spec/support — 2 commits
- samples/memo.pdf — 1 commit
- samples/mevs' white pixel.png — 1 commit
- samples/movie.mp4 — 1 commit
- spec/spec_helper.rb — 1 commit
Notable commits
- fix: Fix Tempfile#size after it’s closed in 1.8.7
- fix: Fix content dup bug which end up with different content sharing same meta object
- fix: Fix forwarding to private method in TempObject
- fix: Fix rack version problem for older rubies (rack 2.0 only works for ruby >= 2.2.2)
- fix: Fix ruby warnings
- fix: Fix url parsing in Dragonfly::Job::FetchUrl
- fix: Merge branch 'temp' - fix multiline data_uri problem with fetch_url
- fix: Merge branch 'temp' - fix warnings
- fix: Merge pull request #313 from bobbus/fix-content-dup
- fix: Merge pull request #507 from thedanbob/uri-parse-fix
- fix: Merge pull request from 'lcoq/fix-model-set-escaped-url'
- fix: Revert "don't actually need padding as Base64.urlsafe_decode64 doesn't need it" - yes it does!
- fix: Revert "i18n version 0.7 doesn’t work with ruby 1.8.7/1.9.2"
- fix: Revert "reverting 982bf063dae9ac140061c19a25d53f1f9875bb5b - there was a reason for RUBY_VERSION-dependent gem dependencies:"
- fix: attempt to fix bundler errors on travis
- fix: attempt to fix rexml problem with ruby 1.9 tests
- fix: bumped rspec version and fixed corresponding errors re. positional args
- fix: fix ruby 2.4.0 regression by not considering order of '.' and '..' nodes when checking for empty directory
- fix: fix travis 1.8.7 failures - pry doesn't seem to be compatible with ruby 1.8 so ignore
- fix: fixed History.md format
- …and 280 more
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
markevans/dragonfly was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 19 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit bff2c331dad5006260a0f385fb2ae2dc2440da14 — the exact code this score is about.
- Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-13a154b7f5d1.