class Packwerk::RunContext
Attributes
checker_classes[R]
custom_associations[R]
inflector[R]
load_paths[R]
package_paths[R]
root_path[R]
Public Class Methods
from_configuration(configuration)
click to toggle source
# File lib/packwerk/run_context.rb, line 25 def from_configuration(configuration) inflector = ::Packwerk::Inflector.from_file(configuration.inflections_file) new( root_path: configuration.root_path, load_paths: configuration.load_paths, package_paths: configuration.package_paths, inflector: inflector, custom_associations: configuration.custom_associations ) end
new( root_path:, load_paths:, package_paths: nil, inflector: nil, custom_associations: [], checker_classes: DEFAULT_CHECKERS )
click to toggle source
# File lib/packwerk/run_context.rb, line 37 def initialize( root_path:, load_paths:, package_paths: nil, inflector: nil, custom_associations: [], checker_classes: DEFAULT_CHECKERS ) @root_path = root_path @load_paths = load_paths @package_paths = package_paths @inflector = inflector @custom_associations = custom_associations @checker_classes = checker_classes end
Public Instance Methods
process_file(file:)
click to toggle source
# File lib/packwerk/run_context.rb, line 54 def process_file(file:) file_processor.call(file) end
Private Instance Methods
checkers()
click to toggle source
# File lib/packwerk/run_context.rb, line 98 def checkers checker_classes.map(&:new) end
constant_name_inspectors()
click to toggle source
# File lib/packwerk/run_context.rb, line 103 def constant_name_inspectors [ ::Packwerk::ConstNodeInspector.new, ::Packwerk::AssociationInspector.new(inflector: inflector, custom_associations: custom_associations), ] end
context_provider()
click to toggle source
# File lib/packwerk/run_context.rb, line 76 def context_provider ::Packwerk::ConstantDiscovery.new( constant_resolver: resolver, packages: package_set ) end
file_processor()
click to toggle source
# File lib/packwerk/run_context.rb, line 61 def file_processor @file_processor ||= FileProcessor.new(node_processor_factory: node_processor_factory) end
node_processor_factory()
click to toggle source
# File lib/packwerk/run_context.rb, line 66 def node_processor_factory NodeProcessorFactory.new( context_provider: context_provider, checkers: checkers, root_path: root_path, constant_name_inspectors: constant_name_inspectors ) end
package_set()
click to toggle source
# File lib/packwerk/run_context.rb, line 93 def package_set ::Packwerk::PackageSet.load_all_from(root_path, package_pathspec: package_paths) end
resolver()
click to toggle source
# File lib/packwerk/run_context.rb, line 84 def resolver ConstantResolver.new( root_path: root_path, load_paths: load_paths, inflector: inflector, ) end