Class: Archsight::Import::Handlers::CrystalGrapher

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

Overview

CrystalGrapher — analyses a Crystal repository and generates a GraphViz DOT graph of its shard/module structure, stored as architecture/crystal/modules on the TechnologyArtifact.

Supports single-shard projects (shard.yml at root) and multi-shard monorepos (*/shard.yml). Uses pure static regex analysis of relative require statements — no Crystal toolchain required.

Only relative requires (./foo or ../bar) point to internal code; absolute requires (require "shard_name") address installed shards in lib/ and are ignored.

Configuration:

import/config/path     - Path to the Crystal 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[lib spec .git bin .crystal tmp coverage].freeze
MAX_PKG_DEPTH =

MAX_PKG_DEPTH = 2: my_shard/feature is the natural depth for Crystal shards.

2
REQUIRE_RE =

Only relative requires point to internal code; absolute requires are external shards.

%r{^\s*require\s+"(\.\.?/[^"]+)"}

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)


24
25
26
27
# File 'lib/archsight/import/handlers/crystal_grapher.rb', line 24

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

.language_nameObject



22
# File 'lib/archsight/import/handlers/crystal_grapher.rb', line 22

def self.language_name = "crystal"

Instance Method Details

#wrap_single_module?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/archsight/import/handlers/crystal_grapher.rb', line 29

def wrap_single_module?
  true
end