This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-10-11
Channels
- # beginners (57)
- # boot (9)
- # clara (9)
- # cljs-dev (12)
- # clojure (98)
- # clojure-boston (1)
- # clojure-dusseldorf (12)
- # clojure-france (1)
- # clojure-greece (1)
- # clojure-spec (41)
- # clojure-uk (86)
- # clojurescript (60)
- # code-art (2)
- # data-science (5)
- # datomic (5)
- # duct (1)
- # fulcro (14)
- # graphql (2)
- # lein-figwheel (4)
- # luminus (1)
- # midje (1)
- # off-topic (19)
- # om (10)
- # onyx (13)
- # pedestal (5)
- # portkey (59)
- # re-frame (31)
- # reagent (1)
- # ring (14)
- # ring-swagger (1)
- # rum (5)
- # shadow-cljs (90)
- # spacemacs (5)
- # specter (47)
- # sql (9)
- # uncomplicate (95)
- # vim (32)
Can anyone point me to any examples of boot tasks being tested end-to-end? I’d like to run (boot (my-task))
inside one of my tests and then check for side effects, but that understandably fails when running tests triggered by a boot test task.
@lsnape there are examples in boot itself using boot.test
give a couple of mins I can fetch one for you
Here it is: https://github.com/boot-clj/boot/blob/master/boot/core/test/boot/task/built_in_test.clj
I am considering writing dynamic versions of import
and require
based on https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Reflector.java .
The idea is to be able to pass the name of the class/method in variables; something like (import-dyn (class-name :as foo))
and static methods as (foo / method-name 5 4 3)
or instance methods as (let [x (foo . 5)] (x . method-name 4 3))
where class-name and method-name are strings [require-dyn would be similar]. Has anyone already done something like this?
@dominicm possibly more appropriate for #clojure but it came up while I was writing a boot task so I went with context rather than content. Specifically, it ties into writing general tasks for a code generator (antlr4) where the names of the class and methods are not known until the grammar is defined. If there are no takers here I will cross post. - https://github.com/aJchemist/boot-protobuf - https://github.com/RadicalZephyr/boot-javac-star - https://github.com/mathias/boot-sassc - etc. It would be nice if the tasks in projects like these include post-tasks that would make live coding more accessible. Here is a sample https://github.com/babeloff/boot-antlr4
Is there a section in the docs that describe how scopes work in boot? Or is it implied from something else?
Think I might have figured it out. It just passes through to maven right? Docs here? https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope
I've been playing around with clojure 1.9 and it's tools.deps to see how it might worth with boot. I came up with this function
(defn maven-deps
([]
(maven-deps "deps.edn" [:deps] "compile"))
([deps-edn path scope]
(let [deps (-> (slurp deps-edn)
(read-string))]
(->> (get-in deps path)
(map (fn [[k v]]
[k (:mvn/version v) :scope scope]))
(into [])))))
which I can then use in my set-env!
like this
(set-env!
:resource-paths #{"src" "test"}
:dependencies (concat (maven-deps)
(maven-deps "deps.edn" [:aliases :test :extra-deps]
"test")))
I think that lets me specify my deps in deps.edn (for the benefit of the standard clj/clojure scripts in clojure 1.9 https://clojure.org/guides/deps_and_cli, and still use boot for build/test etc.
However I'm new to boot so there might be something I'm missing.