Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Made file paths in config relative to config file.

  • Loading branch information...
commit 5cff9b67cb59c98b4ce6d9025f0c8b53f49cdfae 1 parent 381c817
@aroemers authored
1 
@@ -177,7 +177,6 @@ verbose: false
## Future improvements
-* Make 'glue' paths in the config relative to the configuration file.
* Generics support
* Plain, adapter-less injections
* Plug-in system
2  src-java/test/bind.config
@@ -1,7 +1,7 @@
This is a test configuration file. Below, the gluer files are specified. The
paths to these files are relative to this configuration file.
-glue: src-java/test/bind.gluer
+glue: bind.gluer
Other options can be specified as well.
3  src/gluer/agent.clj
@@ -12,6 +12,7 @@
[gluer.resources :as r]
[gluer.runtime :as runtime]
[gluer.config :as c]
+ [gluer.core :as core]
[clojure.string :as s])
(:use [gluer.clauses]
@@ -97,7 +98,7 @@
(with-redefs [*verbose* (:verbose config)]
(log-verbose "Parsing .gluer files and searching for Adapters...")
;; Parse the files and check for parse errors.
- (let [parsed (r/parse-gluer-files (:glue config))
+ (let [parsed (r/parse-gluer-files (core/absolutise agent-args (:glue config)))
erroneous (filter (comp :error :parsed) parsed)]
(if (not (empty? erroneous))
(do (doseq [error erroneous]
12 src/gluer/core.clj
@@ -92,6 +92,16 @@
(catch InterruptedException ex
(println "Errors detected. Fix above errors and re-run the check."))))
+;;; Helper functions.
+(defn absolutise ;--- Move this to a utility namespace?
+ [root-file file-names]
+ (let [root-url ( (str "file:" root-file))]
+ (for [file-name file-names]
+ (.getFile ( root-url file-name)))))
;;; The main entry point.
(defn -main ;--- Maybe reading a JAR file containing .config, .gluer and Adapters is also nice?
@@ -104,6 +114,6 @@
(if-let [config (try (c/read-config (slurp config-file-name))
(catch ioe))]
(with-redefs [*verbose* (or verbose (and (nil? verbose) (:verbose config)))]
- (check (:glue config)))
+ (check (absolutise config-file-name (:glue config))))
(println "Could not find or open file:" config-file-name))
(display-help-text banner)))))
Please sign in to comment.
Something went wrong with that request. Please try again.