   containing at least two keys:
 
   - `plugin`: the plugin name
-  - `require`: a vector of require statements to hand over to
-               `clojure.core/require`
+  - `require`: the namespace to load
 
+  The namespace will be made available using the plugin name's symbol
+  value.
 "
   (:require [clojure.java.classpath :as cp]
             [clojure.java.io        :refer [resource]]

    (read-string src)))

(defn load-from-meta
  "Given a metadata description map, follow requirements"
  [{:keys [plugin require]}]
  (when (seq require)
    (info "loading plugin:" plugin)
    (apply clojure.core/require require)))

(defn load-from-resource
  "Given a path to a java resource, load metadata and apply
   given requirements."
  [src]
  (-> src
      resource

      (load-from-resource desc-file))))

(defn load-plugin
  "Given a plugin name, look for its metadata description file, and
   require plugin's namespace"
  [plugin]
  (load-from-resource (format "riemann_plugin/%s/meta.edn" (name plugin))))

