Dragonfly

Image/asset management for winners

GitHub Repository

Plugins

A Plugin applies a certain configuration to a Dragonfly app, and is simply an object that responds to call, taking the app and any extra args.

class MyPlugin
  def call(app, *args)
    app.configure do
      datastore :couch, :database => 'assets'
      # ...
    end
  end
end

To use it, use plugin in a configuration block

Dragonfly.app.configure do
  plugin MyPlugin.new
  # ...
end

or register a symbol

Dragonfly::App.register_plugin(:my_plugin){ MyPlugin.new }

so you can do

Dragonfly.app.configure do
  plugin :my_plugin
  # ...
end

Any extra arguments to plugin are passed to call after the app argument.

An example of a plugin is the ImageMagick plugin.