View Source Dependents.Tree.DotGraph (Dependents Tree v0.1.34)
Converts a DOT graph (file deps_tree.dot
) into a Dependents.Tree
.
Also returns the directory of a DOT graph given its path.
Summary
Functions
Returns the directory of a DOT graph (file deps_tree.dot
) given its path
.
Returns the Dependents.Tree
of a DOT graph.
Functions
Returns the directory of a DOT graph (file deps_tree.dot
) given its path
.
Examples
iex> alias Dependents.Tree.DotGraph
iex> projs_dir = "c:/Users/Ray/Documents/ex_dev/projects"
iex> path1 = "#{projs_dir}/file_only_logger/deps_tree.dot"
iex> path2 = "#{projs_dir}/file only logger/deps_tree.dot"
iex> {DotGraph.dir(path1), DotGraph.dir(path2)}
{"file_only_logger", nil}
@spec to_tree( {Path.t(), dir :: String.t()}, [String.t()] ) :: Dependents.Tree.t()
Returns the Dependents.Tree
of a DOT graph.
A DOT graph line maps an app to a dependency. For example:
"noaa_observations"
"noaa_observations" -> "ex_doc" [label="~> 0.22"]
"ex_doc" -> "earmark_parser" [label="~> 1.4.0"]
"noaa_observations" -> "io_ansi_table" [label="~> 1.0"]
"noaa_observations" -> "persist_config" [label="~> 0.4"]
Converted into a Dependents.Tree
, the above 5 lines become:
%{
# Number of local dependencies...
noaa_observations: [2],
io_ansi_table: [:noaa_observations],
persist_config: [:noaa_observations]
}
Examples
iex> alias Dependents.Tree.DotGraph
iex> projs_dir = "c:/Users/Ray/Documents/ex_dev/projects"
iex> dir = "noaa_observations"
iex> path = "#{projs_dir}/#{dir}/deps_tree.dot"
iex> dirs = ["io_ansi_table", "log_reset", "persist_config", dir]
iex> DotGraph.to_tree({path, dir}, dirs)
%{
noaa_observations: [3],
log_reset: [:noaa_observations],
io_ansi_table: [:noaa_observations],
persist_config: [:noaa_observations]
}