Skip to content

Commit

Permalink
Fix #148: BASE var default should be the workflow directory
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Crow committed Oct 23, 2014
1 parent a153bf5 commit 93a27fd
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions src/drake/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -645,17 +645,28 @@
{}
pairs))))

(defn figure-workflow-file []
(let [filename (:workflow *options*)
filename (if-not (fs/directory? filename)
filename
(let [workflow-file (str filename
(if (not= (last filename) \/) "/")
"Drakefile")]
workflow-file))]
(fs/absolute-path filename)))

(defn build-vars []
(let [split-regex-str (or
(*options* :split-vars-regex)
DEFAULT-VARS-SPLIT-REGEX-STR)]
(*options* :split-vars-regex)
DEFAULT-VARS-SPLIT-REGEX-STR)]
(merge
(into {} (System/getenv))
(parse-cli-vars (:vars *options*) split-regex-str)
(into {} (for [v (:var *options*)]
(str/split v #"=")))
(when-let [base (:base *options*)]
{"BASE" base}))))
(into {} (System/getenv))
(parse-cli-vars (:vars *options*) split-regex-str)
(into {} (for [v (:var *options*)]
(str/split v #"=")))
(if-let [base (:base *options*)]
{"BASE" base}
{"BASE" (figure-workflow-file)}))))

(defn- with-workflow-file
"Reads the workflow file from command-line options, parses it,
Expand Down

0 comments on commit 93a27fd

Please sign in to comment.