Skip to content

Instantly share code, notes, and snippets.

Last active Sep 16, 2016
What would you like to do?
require "benchmark"
gem = Gem::Specification.find_by_name("shrine")
plugins_dir = "#{gem.full_gem_path}/lib/shrine/plugins"
plugin_names = Dir["#{plugins_dir}/*.rb"].map { |plugin_path| File.basename(plugin_path, ".*").to_sym }
puts Benchmark.realtime {
require "shrine"
plugin_names.each do |plugin_name|
case plugin_name
when :download_endpoint
Shrine.plugin plugin_name, storages: [:cache]
when :remote_url
Shrine.plugin plugin_name, max_size: nil
when :backup
Shrine.plugin plugin_name, storage: :backup_store
when :background_helpers, :migration_helpers
# deprecated
when :activerecord, :sequel
# loading ORMs skews the results
Shrine.plugin plugin_name
puts Benchmark.realtime {
require "carrierwave"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment