Skip to content

Commit 748bed0

Browse files
fixup! fixup! fixup! fixup! fixup! Blah
1 parent 516ddf5 commit 748bed0

File tree

6 files changed

+32
-24
lines changed

6 files changed

+32
-24
lines changed

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ A huge shout out to the people behind these projects.
3737

3838
### dep-matrix
3939

40-
41-
4240
## Usage
4341

4442
### Installation
@@ -89,6 +87,18 @@ Here's a component include dependency visualisation generated for the `queue` co
8987

9088
![Queue include graph d3](docs/examples/rethinkdb_queue_include_d3.svg)
9189

90+
### File include dependency graph
91+
92+
This will highlight include dependencies of files globally within the project
93+
94+
`cpp_dependency_graph visualise_includes -r spec\test\example_project\ -c Engine`
95+
96+
Here's a component include dependency visualisation generated for the `queue` component in [rethinkdb](https://github.com/rethinkdb/rethinkdb)
97+
98+
![Queue include graph dot](docs/examples/rethinkdb_queue_include.svg)
99+
100+
![Queue include graph d3](docs/examples/rethinkdb_queue_include_d3.svg)
101+
92102
### Cyclic dependencies only graph
93103

94104
This will highlight cyclic dependencies between components within a project. This is especially useful for targeted refactoring activities to reduce coupling between components.

exe/cpp_dependency_graph

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,11 @@ doc = <<DOCOPT
3737
Cpp Dependency Graph
3838
3939
Usage:
40-
cpp_dependency_graph visualise --root_dir <argument> [--component <component>] [--output_file <file>] [--output_format <format>]
41-
cpp_dependency_graph visualise_includes --root_dir <argument> [--file <file>] [--component <component>] [--output_file <file>] [--output_format <format>]
40+
cpp_dependency_graph visualise_component --root_dir <argument> --component <component> [--output_file <file>] [--output_format <format>]
41+
cpp_dependency_graph visualise_project --root_dir <argument> [--output_file <file>] [--output_format <format>]
42+
cpp_dependency_graph visualise_component_includes --root_dir <argument> --component <component> [--output_file <file>] [--output_format <format>]
43+
cpp_dependency_graph visualise_header_includes --root_dir <argument> --header <header> [--output_file <file>] [--output_format <format>]
44+
cpp_dependency_graph visualise_project_includes --root_dir <argument> [--output_file <file>] [--output_format <format>]
4245
cpp_dependency_graph visualise_components --root_dir <argument> [--output_file <file>] [--output_format <format>]
4346
cpp_dependency_graph visualise_cyclic_deps --root_dir <argument> [--component <component>] [--output_file <file>] [--output_format <format>]
4447
cpp_dependency_graph -h | --help | -v | --version
@@ -47,9 +50,10 @@ doc = <<DOCOPT
4750
-h --help show this help message and exit
4851
-v --version show version and exit
4952
-r --root_dir dir top level root directory of C/C++ project
50-
-c --component component component generate visualisation for (case sensitive!)
5153
-o --output_file file name of output file to be generated [default: deps.html]
5254
-f --output_format format format of output file (dot, html, graphml, json) [default: html]
55+
--component component component generate visualisation for (case sensitive!)
56+
--header file header file to generate visualisation for (case sensitive!)
5357
DOCOPT
5458

5559
begin
@@ -67,20 +71,16 @@ begin
6771
Kernel.exit(1)
6872
end
6973

70-
if args['visualise']
71-
if args['--component']
72-
generate_component_graph(project_dir, args['--component'], args['--output_format'], args['--output_file'])
73-
else
74-
generate_project_graph(project_dir, args['--output_format'], args['--output_file'])
75-
end
76-
elsif args['visualise_includes']
77-
if args['--component']
78-
generate_component_include_graph(project_dir, args['--component'], args['--output_format'], args['--output_file'])
79-
elsif args['--file']
80-
generate_file_include_graph(project_dir, args['--file'], args['--output_format'], args['--output_file'])
81-
else
82-
generate_project_include_graph(project_dir, args['--output_format'], args['--output_file'])
83-
end
74+
if args['visualise_component']
75+
generate_component_graph(project_dir, args['--component'], args['--output_format'], args['--output_file'])
76+
elsif args['visualise_project']
77+
generate_project_graph(project_dir, args['--output_format'], args['--output_file'])
78+
elsif args['visualise_component_includes']
79+
generate_component_include_graph(project_dir, args['--component'], args['--output_format'], args['--output_file'])
80+
elsif args['visualise_header_includes']
81+
generate_file_include_graph(project_dir, args['--header'], args['--output_format'], args['--output_file'])
82+
elsif args['visualise_project_includes']
83+
generate_project_include_graph(project_dir, args['--output_format'], args['--output_file'])
8484
elsif args['visualise_components']
8585
generate_enclosure_diagram(project_dir, args['--output_file'])
8686
elsif args['visualise_cyclic_deps']

lib/cpp_dependency_graph.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def generate_component_graph(project_dir, component, format, output_file)
2929
def generate_file_include_graph(project_dir, file_name, format, output_file)
3030
project = Project.new(project_dir)
3131
graph = IncludeFileDependencyGraph.new(project)
32-
deps = graph.file_links(component_name)
32+
deps = graph.links(file_name)
3333
generate_visualisation(deps, format, output_file)
3434
end
3535

lib/cpp_dependency_graph/graph_to_dot_visualiser.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def generate(deps, file)
88
@g = GraphViz.new('dependency_graph')
99
nodes = create_nodes(deps)
1010
connect_nodes(deps, nodes)
11-
File.write(file, @g.to_dot)
11+
@g.output(:dot => file)
1212
end
1313

1414
private

lib/cpp_dependency_graph/include_file_dependency_graph.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
require_relative 'link'
55
require_relative 'cycle_detector'
66

7-
require 'pp'
8-
97
# Returns a hash of individual file include links
108
class IncludeFileDependencyGraph
119
def initialize(project)

lib/cpp_dependency_graph/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module CppDependencyGraph
4-
VERSION = '0.3.0'
4+
VERSION = '0.4.0'
55
end

0 commit comments

Comments
 (0)