Skip to content

Instantly share code, notes, and snippets.

@Deraen
Last active August 29, 2015 14:13
Show Gist options
  • Select an option

  • Save Deraen/a48dae842274dc21022e to your computer and use it in GitHub Desktop.

Select an option

Save Deraen/a48dae842274dc21022e to your computer and use it in GitHub Desktop.
Set c.t.n refresh dirs, boot & lein. Ignores dirs where `.no-reload` file exists.
(ns user
(:require [clojure.tools.namespace.repl :as ns-tools]
[clojure.string :as string]
[clojure.java.io :as io]))
(ns-tools/disable-reload!)
(let [reload-dirs (->> (or (try
(require 'boot.core)
((resolve 'boot.core/get-env) :directories)
(catch Exception _
nil))
; Leiningen
(do (require 'clojure.tools.namespace.dir)
((resolve 'clojure.tools.namespace.dir/dirs-on-classpath))))
(remove #(.exists (io/file % ".no-reload"))))]
(println "Reload dirs:" reload-dirs)
(apply ns-tools/set-refresh-dirs reload-dirs))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment