Class: Archsight::Import::Handlers::ElixirGrapher

Inherits:
Grapher show all
Defined in:
lib/archsight/import/handlers/elixir_grapher.rb

Overview

ElixirGrapher — analyses an Elixir repository and generates a GraphViz DOT graph of its application/package structure, stored as architecture/elixir/modules on the TechnologyArtifact.

Supports single-app projects (mix.exs at root) and umbrella projects (apps/*/mix.exs). Uses pure static regex analysis of alias/import/use statements — no Elixir toolchain required.

Configuration:

import/config/path     - Path to the Elixir repository root
import/config/ranksep  - Horizontal gap between rank columns (default: 0.6)
import/config/nodesep  - Vertical gap between nodes in a column (default: 0.15)

Constant Summary collapse

SKIP_DIRS =
%w[_build deps test tests .git cover priv node_modules _checkouts config].freeze
MAX_PKG_DEPTH =

MAX_PKG_DEPTH = 3 allows my_app/web/controllers depth, which is common in Phoenix apps.

3
ALIAS_RE =
/^\s*alias\s+(\w+(?:\.\w+)*(?:\.\{[^}]*\})?)/
IMPORT_RE =
/^\s*import\s+([\w.]+)/
USE_RE =
/^\s*use\s+([\w.]+)/

Constants inherited from Grapher

Grapher::PALETTE

Instance Attribute Summary

Attributes inherited from Archsight::Import::Handler

#database, #import_resource, #progress, #resources_dir, #shared_writer

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Grapher

#dot_graph, #execute, #safe_glob

Methods inherited from Archsight::Import::Handler

#compute_config_hash, #config, #config_all, #execute, #import_yaml, #initialize, #resource_yaml, #resources_to_yaml, #self_marker, #write_generates_meta, #write_yaml

Constructor Details

This class inherits a constructor from Archsight::Import::Handler

Class Method Details

.applicable?(path) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
24
# File 'lib/archsight/import/handlers/elixir_grapher.rb', line 21

def self.applicable?(path)
  File.exist?(File.join(path, "mix.exs")) ||
    Dir.glob(File.join(path, "apps/*/mix.exs")).any?
end

.language_nameObject



19
# File 'lib/archsight/import/handlers/elixir_grapher.rb', line 19

def self.language_name = "elixir"

Instance Method Details

#wrap_single_module?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/archsight/import/handlers/elixir_grapher.rb', line 26

def wrap_single_module?
  true
end