class Bibliothecary::Parsers::CPAN

Public Class Methods

mapping() click to toggle source
# File lib/bibliothecary/parsers/cpan.rb, line 9
def self.mapping
  {
    match_filename("META.json", case_insensitive: true) => {
      kind: "manifest",
      parser: :parse_json_manifest,
    },
    match_filename("META.yml", case_insensitive: true) => {
      kind: "manifest",
      parser: :parse_yaml_manifest,
    },
  }
end
parse_json_manifest(file_contents, options: {}) click to toggle source
# File lib/bibliothecary/parsers/cpan.rb, line 24
def self.parse_json_manifest(file_contents, options: {}) # rubocop:disable Lint/UnusedMethodArgument
  manifest = JSON.parse file_contents
  manifest["prereqs"].map do |_group, deps|
    map_dependencies(deps, "requires", "runtime")
  end.flatten
end
parse_yaml_manifest(file_contents, options: {}) click to toggle source
# File lib/bibliothecary/parsers/cpan.rb, line 31
def self.parse_yaml_manifest(file_contents, options: {}) # rubocop:disable Lint/UnusedMethodArgument
  manifest = YAML.load file_contents
  map_dependencies(manifest, "requires", "runtime")
end