Skip to content
Library to keep track of changes to Clojure source files
Clojure
Find file
Pull request Compare This branch is 35 commits behind weavejester:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
src/ns_tracker
test/ns_tracker/test
.gitignore
.travis.yml
README.markdown
project.clj

README.markdown

ns-tracker

Build Status

ns-tracker is a Clojure library for keeping track of changes to source files and their associated namespaces. This is usually used to automatically reload modified namespaces in a running Clojure application.

It is derived from code in Stuart Sierra's Lazytest tool, and the credit for writing the vast majority of the code used in this library should therefore go to him.

Installation

As usual, to use this library, add the following dependency to your project.clj file:

[ns-tracker "0.2.0"]

Usage

Use the ns-tracker.core/ns-tracker function to create a new tracker function for one or more source directories:

(use 'ns-tracker.core)

(def modified-namespaces
  (ns-tracker ["src" "test"]))

When you call the modified-namespaces function, it will return a list of Clojure namespaces that have changed. You can then reload them on the fly:

(doseq [ns-sym (modified-namespaces)]
  (require ns-sym :reload))

This can be placed in a background thread, or triggered by some user request.

License

Copyright (C) 2012 Stuart Sierra, James Reeves

Distributed under the Eclipse Public License.

Something went wrong with that request. Please try again.