Skip to content

Commit

Permalink
Fixes #16 ignore path
Browse files Browse the repository at this point in the history
  • Loading branch information
jonpither committed Mar 8, 2016
1 parent ccfc3bd commit 2812f58
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ where the hub is:

Add the config `CIDER_SPY_ALIAS` so that [`environ`](https://github.com/weavejester/environ) can see it.

Add a regexp to the config variable `CIDER_SPY_IGNORE_PATH` (again use `environ`).

## Developing

It's extremely useful to make `core` a lein checkouts dependency of `example-project`.
Expand Down
8 changes: 6 additions & 2 deletions core/src/cider_spy_nrepl/middleware/tracker.clj
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,22 @@
[clojure.tools.analyzer.jvm :as ana-jvm]
[clojure.tools.analyzer.env :as env]
[clojure.tools.namespace.parse :as clj-tools-namespace-parse]
[clojure.tools.reader.edn :as edn])
[clojure.tools.reader.edn :as edn]
[environ.core])
(:import (java.io PushbackReader)
(org.joda.time LocalDateTime)))

(defn- safe-inc [v]
(if v (inc v) 1))

(defn- ignore-ns? [ns]
(some-> :cider-spy-ignore-path environ.core/env re-pattern (re-find ns)))

(defn- add-to-ns-trail
"The user namespace is ignored. If the same ns is given as currently
at the head, it is also ignored."
[tracking ns]
(if (and ns (not= "user" ns))
(if (and ns (not= "user" ns) (not (ignore-ns? ns)))
(update-in tracking [:ns-trail] conj {:dt (LocalDateTime.) :ns ns})
tracking))

Expand Down

0 comments on commit 2812f58

Please sign in to comment.