Sha256: 612b2ecca01fcc96b08d4249bd0126c2ee4ee059bf8e21a9366f386ae18caa82
Contents?: true
Size: 1.08 KB
Versions: 35
Compression:
Stored size: 1.08 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: {}) 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: {}) 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
35 entries across 35 versions & 1 rubygems