Class: Archsight::Import::Handlers::RubyGrapher

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

Overview

RubyGrapher handler - analyses a Ruby repository and generates a GraphViz DOT graph of its gem/package structure, stored as architecture/modules on the TechnologyArtifact so it can be rendered in the frontend.

Uses static regex analysis of require/require_relative statements. Package paths are normalised to "/" separators internally so they are compatible with the generic Grapher layout engine.

Configuration:

import/config/path     - Path to the Ruby 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[test spec tests vendor .git node_modules tmp log coverage .bundle
pkg doc docs generated].freeze
MAX_PKG_DEPTH =

Packages with more than this many path components are folded into their ancestor. Ruby gems use lib//.rb, so depth 2 gives one level of features.

2

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
25
# File 'lib/archsight/import/handlers/ruby_grapher.rb', line 21

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

.language_nameObject



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

def self.language_name = "ruby"

Instance Method Details

#wrap_single_module?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/archsight/import/handlers/ruby_grapher.rb', line 27

def wrap_single_module?
  true
end