Skip to content

Generates a dependency hierarchy graph for Leiningen projects.

License

Notifications You must be signed in to change notification settings

ashercoren/lein-hiera

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lein-hiera

Generates a graph of the dependency hierarchy of a set of clojure files. This uses the clojure.tools.namespace library for namespace parsing and Rhizome for graph generation using Graphviz.

This plugin is inspired by lein-ns-dep-graph, but has many additional options for graph generation.

Usage

Plugin releases are published on Clojars. To use the latest verison with Leiningen, add the following to your project definition or user profile plugins:

Clojars Project

A namespace graph can be generated by running:

$ lein hiera

This will generate a dependency graph in target/ns-hierarchy.png, showing the interdependency of the project's source namespaces. By default, all directories in the project's :source-paths are included. Additional directories to include may be given as command-line arguments:

$ lein hiera ../foo-lib/src ../bar-lib/src

Example

This image shows the dependency hierarchy from a moderately complex project. The namespaces are clustered by two levels, and it shows a dependency on the external puget library.

Example dependency hierarchy

Options

Graph generation may be controlled with additional options under the :hiera key in the project map. The available options, and their default values are:

:hiera
{:path "target/ns-hierarchy.png"
 :vertical true
 :show-external false
 :cluster-depth 0
 :trim-ns-prefix true
 :ignore-ns #{}}
name description
:path Gives the location to output the graph image to.
:vertical Specifies whether to lay out the graph vertically or horizontally.
show-external When set, the graph will include nodes for namespaces which are not defined in the source files, marked by a dashed border.
:cluster-depth Sets the number of namespace segments to cluster nodes by. Clusters must contain at least one fewer segment than the nodes themselves.
:trim-ns-prefix When set, clustered namespaces will have the cluster prefix removed from the node labels.
:ignore-ns A set of namespace prefixes to exclude from the graph. For example, #{clojure} would exclude clojure.string, clojure.java.io, etc.

License

This is free and unencumbered software released into the public domain. See the UNLICENSE file for more information.

About

Generates a dependency hierarchy graph for Leiningen projects.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Clojure 100.0%