Skip to content
franks42 edited this page Sep 14, 2012 · 11 revisions

For any project where you want to add the ability to browse your currently loaded/unloaded namespaces for the available functions/macros/vars with their docs/source, you should add clj-ns-browser to your :dev-dependencies list:

  • in your project.clj, add:
    ;; Leiningen version 1.x
    :dev-dependencies [[clj-ns-browser "1.3.0"]]

    ;; Leiningen version 2
    :profiles {:dev {:dependencies [[clj-ns-browser "1.3.0"]]}}

Then:

$ lein deps  
$ lein repl  
user=> (use 'clj-ns-browser.sdoc)  
user=> (sdoc)  

This should bring up a browser window with "clj-ns-browser.sdoc/sdoc" selected - very easy!

It should actually work from any repl - tested with repls, emacs and Sublime Text 2. If you made it work with other repl's or face any installation issues, please let us know.

It has failed to work with 2.0.0-preview3 for some reason we are not sure of -- perhaps a conflicting version of the cd-client being used between Leiningen and clj-ns-browser. It has worked with Leiningen version 1.7.1 and 2.0.0-preview4.

Compiling and installing your own local version from source

Why might you wish to do this? The primary reason is if you want to make your own local changes to the source code, or you wish to try out changes made by others that have not yet been released to a Maven repository like clojars.org.

You can retrieve a local copy of the source code with a command like this:

$ git clone git://github.com/franks42/clj-ns-browser.git
$ cd clj-ns-browser

Then the following command will compile a jar file and install it in your local Maven repository (usually in the directory .m2 in your home directory):

$ lein install

If everything goes well, the last lines of the output of the command above should look similar to this:

Compilation succeeded.
Created /Users/jafinger/clj/clj-ns-browser/clj-ns-browser-1.3.0-SNAPSHOT.jar
Wrote pom.xml
[INFO] Installing /Users/jafinger/clj/clj-ns-browser/clj-ns-browser-1.3.0-SNAPSHOT.jar to /Users/jafinger/.m2/repository/clj-ns-browser/clj-ns-browser/1.3.0-SNAPSHOT/clj-ns-browser-1.3.0-SNAPSHOT.jar

By examining the version part of the jar file installed, you get the version string that you can put into the project.clj file of a different Leiningen project on your machine, like so:

    ;; Leiningen version 1.x
    :dev-dependencies [[clj-ns-browser "1.3.0-SNAPSHOT"]]

    ;; Leiningen version 2
    :profiles {:dev {:dependencies [[clj-ns-browser "1.3.0-SNAPSHOT"]]}}

From there the usage instructions are the same as given at the beginning of this page.

You can make further clj-ns-browser source code changes and repeat the "lein install" step to update what is installed in your local Maven repository. You can erase those files from your local Maven repository if you do not want them to "shadow" a version in a remote repository.

Clone this wiki locally