Class: DependencyChecker::MetadataChecker

Inherits:
Object
  • Object
show all
Defined in:
lib/dependency_checker/metadata_checker.rb

Overview

Class for checking metadata in the dependency checker.

The MetadataChecker class is responsible for performing checks on metadata files in the context of the dependency checker. It includes methods for verifying metadata information such as module name, version, and dependencies.

Example usage:

checker = DependencyChecker::MetadataChecker.new
result = checker.()
puts result.message if result.failed?

Author:

  • Ewoud Kohl van Wijngaarden <ewoud@kohlvanwijngaarden.nl>

Since:

  • 1.0.0

Instance Method Summary collapse

Constructor Details

#initialize(metadata, forge, updated_module, updated_module_version) ⇒ MetadataChecker

Returns a new instance of MetadataChecker.

Since:

  • 1.0.0



22
23
24
25
26
27
# File 'lib/dependency_checker/metadata_checker.rb', line 22

def initialize(, forge, updated_module, updated_module_version)
  @metadata = 
  @forge = forge
  @updated_module = updated_module.sub('-', '/') if updated_module
  @updated_module_version = updated_module_version if updated_module_version
end

Instance Method Details

#check_dependenciesMap

Perform constraint comparisons of dependencies based on their latest version, and also override any occurance of @updated_module with @updated_module_version

Returns:

  • (Map)

    a map of dependencies along with their constraint, current version and whether they satisfy the constraint

Since:

  • 1.0.0



32
33
34
35
36
37
38
# File 'lib/dependency_checker/metadata_checker.rb', line 32

def check_dependencies
  fetch_module_dependencies.map do |dependency, constraint|
    dependency = dependency.sub('-', '/')
    current = dependency == @updated_module ? SemanticPuppet::Version.parse(@updated_module_version) : @forge.get_current_version(dependency)
    [dependency, constraint, current, constraint.include?(current)]
  end
end