Skip to content

Commit

Permalink
Rename :include-refsets? to :optional-deps
Browse files Browse the repository at this point in the history
Related to: weavejester#77
  • Loading branch information
clyfe committed Dec 5, 2020
1 parent b4f77b0 commit d26aa89
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/integrant/core.cljc
Expand Up @@ -133,13 +133,13 @@
"Return a dependency graph of all the refs and refsets in a config. Resolves
derived dependencies. Takes the following options:
`:include-refsets?`
: whether to include refsets in the dependency graph (defaults to true)"
`:optional-deps?`
: whether to include optional deps in the dependency graph (defaults to true)"
([config]
(dependency-graph config {}))
([config {:keys [include-refsets?] :or {include-refsets? true}}]
([config {:keys [optional-deps?] :or {optional-deps? true}}]
(letfn [(find-refs [v]
(find-derived-refs config v include-refsets?))]
(find-derived-refs config v optional-deps?))]
(reduce-kv (fn [g k v] (reduce #(dep/depend %1 k %2) g (find-refs v)))
(dep/graph)
config))))
Expand All @@ -152,7 +152,7 @@
(dep/topo-comparator #(compare (str %1) (str %2)) graph))

(defn- find-keys [config keys f]
(let [graph (dependency-graph config {:include-refsets? false})
(let [graph (dependency-graph config {:optional-deps? false})
keyset (set (mapcat #(map key (find-derived config %)) keys))]
(->> (f graph keyset)
(set/union keyset)
Expand Down
2 changes: 1 addition & 1 deletion test/integrant/core_test.cljc
Expand Up @@ -162,7 +162,7 @@
(is (dep/depends? g ::b ::pp))))

(testing "graph without refsets"
(let [g (ig/dependency-graph m {:include-refsets? false})]
(let [g (ig/dependency-graph m {:optional-deps? false})]
(is (dep/depends? g ::a ::p))
(is (not (dep/depends? g ::b ::p)))
(is (not (dep/depends? g ::b ::pp)))))))
Expand Down

0 comments on commit d26aa89

Please sign in to comment.