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"
|
||||
:url "https://github.com/lacarmen/cryogen-core"
|
||||
:license {:name "Eclipse Public License"
|
||||
|
|
|
@ -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")]
|
||||
|
|
Loading…
Reference in a new issue