Sha256: b6848b19b8e3b4ce4d7b37ac453cfb200a302932c111fb7e0fd4ea115e2985c2
Contents?: true
Size: 1.05 KB
Versions: 15
Compression:
Stored size: 1.05 KB
Contents
require "yaml" require "json" module Bibliothecary module Parsers class CPAN include Bibliothecary::Analyser 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 add_multi_parser(Bibliothecary::MultiParsers::DependenciesCSV) 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 def self.parse_yaml_manifest(file_contents, options: {}) # rubocop:disable Lint/UnusedMethodArgument manifest = YAML.load file_contents map_dependencies(manifest, "requires", "runtime") end end end end
Version data entries
15 entries across 15 versions & 1 rubygems