Class: RubyLens::Index::RubydexAdapter
- Inherits:
-
Object
- Object
- RubyLens::Index::RubydexAdapter
- Defined in:
- lib/rubylens/index/rubydex_adapter.rb
Constant Summary collapse
- TEST_SEGMENTS =
%w[test tests spec specs feature features].freeze
Instance Method Summary collapse
- #index(manifest) ⇒ Object
-
#initialize(graph_factory: nil) ⇒ RubydexAdapter
constructor
A new instance of RubydexAdapter.
Constructor Details
#initialize(graph_factory: nil) ⇒ RubydexAdapter
Returns a new instance of RubydexAdapter.
12 13 14 |
# File 'lib/rubylens/index/rubydex_adapter.rb', line 12 def initialize(graph_factory: nil) @graph_factory = graph_factory || ->(root) { Rubydex::Graph.new(workspace_path: root.to_s) } end |
Instance Method Details
#index(manifest) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/rubylens/index/rubydex_adapter.rb', line 16 def index(manifest) @location_path_cache = {} @workspace_location_cache = {} graph = @graph_factory.call(manifest.root) index_errors = Array(graph.index_all(manifest.files)) graph.resolve integrity_failures = Array(graph.check_integrity) collected = collect_declarations(graph.declarations, manifest) workspace = workspace_namespaces(collected.fetch(:workspace_records), manifest) inbound_references = inbound_workspace_references(graph, manifest, workspace.fetch(:ordinal_by_name)) { "schema" => "rubylens.snapshot.v5", "project_name" => project_name(manifest), "components" => workspace.fetch(:component_counts), "namespace_names" => workspace.fetch(:records).map { |declaration, _definitions| declaration.name }, "namespaces" => build_workspace_rows(workspace, inbound_references, manifest), "category_stats" => collected.fetch(:category_stats), "dependency_signal_maxima" => collected.fetch(:dependency_aggregation).signal_maxima, "packages" => build_package_rows(collected.fetch(:dependency_aggregation), manifest), "warning_counts" => { "manifest" => manifest.warnings.length, "index" => index_errors.length, "integrity" => integrity_failures.length, }, } ensure @location_path_cache = nil @workspace_location_cache = nil end |