Sha256: 62de911c57249e0af68a35cb1973dd2b6d89b9c24ec386347f9d4132fa22a5c0
Contents?: true
Size: 1.17 KB
Versions: 6
Compression:
Stored size: 1.17 KB
Contents
require "yaml" module Bibliothecary module Parsers class Pub include Bibliothecary::Analyser def self.mapping { match_filename("pubspec.yaml", case_insensitive: true) => { kind: "manifest", parser: :parse_yaml_manifest, }, match_filename("pubspec.lock", case_insensitive: true) => { kind: "lockfile", parser: :parse_yaml_lockfile, }, } end add_multi_parser(Bibliothecary::MultiParsers::DependenciesCSV) def self.parse_yaml_manifest(file_contents, options: {}) # rubocop:disable Lint/UnusedMethodArgument manifest = YAML.load file_contents map_dependencies(manifest, "dependencies", "runtime") + map_dependencies(manifest, "dev_dependencies", "development") end def self.parse_yaml_lockfile(file_contents, options: {}) # rubocop:disable Lint/UnusedMethodArgument manifest = YAML.load file_contents manifest.fetch("packages", []).map do |name, dep| { name: name, requirement: dep["version"], type: "runtime", } end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems