updated to use init function to load plugins
This commit is contained in:
parent
96502bd517
commit
fee46ddf54
2 changed files with 6 additions and 4 deletions
|
@ -1,4 +1,4 @@
|
||||||
(defproject cryogen-core "0.1.16"
|
(defproject cryogen-core "0.1.17"
|
||||||
:description "Cryogen's compiler"
|
:description "Cryogen's compiler"
|
||||||
:url "https://github.com/lacarmen/cryogen-core"
|
:url "https://github.com/lacarmen/cryogen-core"
|
||||||
:license {:name "Eclipse Public License"
|
:license {:name "Eclipse Public License"
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
(ns cryogen-core.plugins
|
(ns cryogen-core.plugins
|
||||||
(:require [cryogen-core.compiler :refer [compile-assets-timed]]
|
(:require [cryogen-core.compiler :refer [compile-assets-timed]]
|
||||||
[clojure.edn :as edn]
|
[clojure.edn :as edn]
|
||||||
|
[clojure.string :as s]
|
||||||
[text-decoration.core :refer :all]))
|
[text-decoration.core :refer :all]))
|
||||||
|
|
||||||
(defn load-plugin [url]
|
(defn load-plugin [url]
|
||||||
(let [config (edn/read-string (slurp url))]
|
(let [{:keys [description init]} (edn/read-string (slurp url))]
|
||||||
(println (green (str "loading module: " (:description config))))
|
(println (green (str "loading module: " description)))
|
||||||
(require (:namespace config))))
|
(-> init str (s/split #"/") first symbol require)
|
||||||
|
((resolve init))))
|
||||||
|
|
||||||
(defn load-plugins []
|
(defn load-plugins []
|
||||||
(let [plugins (.getResources (ClassLoader/getSystemClassLoader) "plugin.edn")]
|
(let [plugins (.getResources (ClassLoader/getSystemClassLoader) "plugin.edn")]
|
||||||
|
|
Loading…
Reference in a new issue