Markdown Converter
Agent skill for markdown-converter
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Sign in to like and favorite skills
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a Rails engine that integrates Cloudinary image hosting with Alchemy CMS. It replaces Alchemy's default Dragonfly storage with Cloudinary's cloud-based image service, allowing images to be stored on Cloudinary and rendered with on-demand transformations.
Engine Initialization (
lib/alchemy_cloudinary/engine.rb)
:alchemy_cloudinary)Alchemy::StorageAdapter::Dragonfly.picture_url_class to use CloudinaryUrlStorage Layer
DragonflyDataStore: Handles upload/download/destroy operations via Cloudinary APIStorePictureThumb: No-op class - thumbnails aren't stored because Cloudinary renders them on-demandCloudinaryUrl: Generates Cloudinary URLs with transformation parameters (crop, resize, format, etc.)The
CloudinaryUrl class inherits from Alchemy::StorageAdapter::Dragonfly::PictureUrl and overrides URL generation to:
crop_from and crop_sizepicture.image_file.remote_url() with Cloudinary transformation syntaxfill (crop), fit (upsample), limit (default)# Run all tests bundle exec rake spec # or bundle exec rspec # Run specific test file bundle exec rspec spec/models/alchemy/storage_adapter/dragonfly/cloudinary_url_spec.rb # Run with specific seed for reproducibility bundle exec rspec --seed 12345
# Install dependencies bundle install # Build gem gem build alchemy_cloudinary.gemspec # Install locally built gem gem install alchemy_cloudinary-*.gem
Tests load only the minimal Alchemy CMS classes needed:
active_support/core_ext/object/blank for .present? methodAlchemy::StorageAdapter::Dragonfly::PictureUrl parent class directlypicture and image_file objectsThe test helper (
spec/rails_helper.rb) manually sets up the load path to require the actual Alchemy parent class, then loads the CloudinaryUrl subclass.
.ruby-version)Users need to configure Cloudinary credentials via:
CLOUDINARY_URL environment variable (recommended for production)config/cloudinary.yml file (should be gitignored)config/initializers/cloudinary.rbThe gem automatically configures Alchemy to use this storage adapter when loaded.