module Crystal @plugin_initializers = {} class << self attr_accessor :plugin_initializers def initialize_plugin type, dir, *args, &block type = type.to_s plugin_initializers.must.include(type) pi_class = plugin_initializers[type] pi = pi_class.new dir, *args block.call pi if block end end end require 'crystal_ext/plugin/web' crystal.plugin_initializers['web'] = Crystal::Plugin::Web require 'crystal_ext/plugin/app' crystal.plugin_initializers['app'] = Crystal::Plugin::App