Tasks: fix execution of fully qualified symbol
This commit is contained in:
parent
647ef40250
commit
21bb768e9f
3 changed files with 19 additions and 5 deletions
|
|
@ -162,10 +162,11 @@
|
|||
prog (wrap-depends prog depends parallel?)
|
||||
prog (wrap-def task-name prog parallel? last? log-level)
|
||||
prog (format "
|
||||
(do (require (quote %s))
|
||||
%s)"
|
||||
(when-not (resolve '%s) (require (quote %s)))
|
||||
%s"
|
||||
task
|
||||
(namespace task)
|
||||
prog)]
|
||||
prog)]
|
||||
prog)
|
||||
(let [task (pr-str task)
|
||||
prog (wrap-depends task depends parallel?)
|
||||
|
|
|
|||
|
|
@ -8,4 +8,5 @@
|
|||
|
||||
(defn foo
|
||||
"Foo docstring"
|
||||
[])
|
||||
[]
|
||||
:foo)
|
||||
|
|
|
|||
|
|
@ -98,7 +98,19 @@
|
|||
(is (= "quux\nbaz\nbar\nfoo\n" (slurp out)))))
|
||||
(testing "map returned from task"
|
||||
(test-utils/with-config '{:tasks {foo {:task {:a 1 :b 2}}}}
|
||||
(is (= {:a 1 :b 2} (bb "foo")))))))
|
||||
(is (= {:a 1 :b 2} (bb "foo")))))
|
||||
(testing "fully qualified symbol execution"
|
||||
(test-utils/with-config {:paths ["test-resources/task_scripts"]
|
||||
:tasks '{foo tasks/foo}}
|
||||
(is (= :foo (bb "foo"))))
|
||||
(test-utils/with-config {:paths ["test-resources/task_scripts"]
|
||||
:tasks '{:requires ([tasks :as t])
|
||||
foo t/foo}}
|
||||
(is (= :foo (bb "foo"))))
|
||||
(test-utils/with-config {:paths ["test-resources/task_scripts"]
|
||||
:tasks '{foo {:requires ([tasks :as t])
|
||||
:task t/foo}}}
|
||||
(is (= :foo (bb "foo")))))))
|
||||
|
||||
(deftest list-tasks-test
|
||||
(test-utils/with-config {}
|
||||
|
|
|
|||
Loading…
Reference in a new issue