Project

graphwerk

0.0
The project is in a healthy, maintained state
Visualise dependencies between your application and it's Packwerk packages using Graphviz.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
 Project Readme

graphwerk-logo

Graphwerk Gem Version CI Badge

Graphwerk is a small Ruby gem that can generate a diagram of dependencies between packages within an application that's using Packwerk to enforce boundaries.

The gem builds on top of Packwerk and Graphviz.

Here's an example application package dependency diagram:

example

Install

Add this line to your application's Gemfile and run bundle install:

gem 'graphwerk'

Usage

For Rails applications a Railtie automatically loads a rake task that makes it easy to generate a diagram for your root package and its dependencies. The diagram will be placed at the root of your application as packwerk.png.

bundle exec rake graphwerk:update

More advance usage is possible by passing a Packwerk::PackageSet directly to Graphwerk::Builders::Graph and calling #build returning a Graphviz instance:

graph = Graphwerk::Builders::Graph.new(
   Packwerk::PackageSet.load_all_from(".")
).build
graph.output(svg: 'packwerk.svg')

All Graphviz layouts are supported and options for the graph, nodes and edges can be set via an optional options argument:

graph = Graphwerk::Builders::Graph.new(
   Packwerk::PackageSet.load_all_from("."),
   options: {
     layout: Graphwerk::Layout::Twopi,
     graph: { overlap: true },
     node: { fillcolor: '#000000' },
     edges: { len: '3.0' }
    }
).build
graph.output(svg: 'packwerk.svg')