From fee46ddf5484c55b17182a13b1bf2969fe0c238c Mon Sep 17 00:00:00 2001 From: Yogthos Date: Wed, 14 Jan 2015 22:07:51 -0500 Subject: [PATCH] updated to use init function to load plugins --- project.clj | 2 +- src/cryogen_core/plugins.clj | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/project.clj b/project.clj index 9401572..2f6ce03 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject cryogen-core "0.1.16" +(defproject cryogen-core "0.1.17" :description "Cryogen's compiler" :url "https://github.com/lacarmen/cryogen-core" :license {:name "Eclipse Public License" diff --git a/src/cryogen_core/plugins.clj b/src/cryogen_core/plugins.clj index 35f6a7c..86b2990 100644 --- a/src/cryogen_core/plugins.clj +++ b/src/cryogen_core/plugins.clj @@ -1,12 +1,14 @@ (ns cryogen-core.plugins (:require [cryogen-core.compiler :refer [compile-assets-timed]] [clojure.edn :as edn] + [clojure.string :as s] [text-decoration.core :refer :all])) (defn load-plugin [url] - (let [config (edn/read-string (slurp url))] - (println (green (str "loading module: " (:description config)))) - (require (:namespace config)))) + (let [{:keys [description init]} (edn/read-string (slurp url))] + (println (green (str "loading module: " description))) + (-> init str (s/split #"/") first symbol require) + ((resolve init)))) (defn load-plugins [] (let [plugins (.getResources (ClassLoader/getSystemClassLoader) "plugin.edn")]