Sha256: 8b666e7a52257a6d3a01f774a1496776bab9418ef8b98c9becf09a3c7c9d326f
Contents?: true
Size: 1.04 KB
Versions: 21
Compression:
Stored size: 1.04 KB
Contents
require 'yaml' module Bibliothecary module Parsers class Shard include Bibliothecary::Analyser def self.mapping { /^shard\.yml$/i => { kind: 'manifest', parser: :parse_yaml_manifest }, /^shard\.lock$/i => { kind: 'lockfile', parser: :parse_yaml_lockfile } } end def self.parse_yaml_lockfile(file_contents) manifest = YAML.load file_contents map_dependencies(manifest, 'shards', 'runtime') end def self.parse_yaml_manifest(file_contents) manifest = YAML.load file_contents map_dependencies(manifest, 'dependencies', 'runtime') + map_dependencies(manifest, 'development_dependencies', 'runtime') end def self.map_dependencies(hash, key, type) hash.fetch(key,[]).map do |name, requirement| { name: name, requirement: requirement['version'] || '*', type: type } end end end end end
Version data entries
21 entries across 21 versions & 1 rubygems