Sha256: 19083c52c37b97f1cd30281180c45a063c2a092dcf8a1e6eabcc29fc99ff2da5
Contents?: true
Size: 937 Bytes
Versions: 3
Compression:
Stored size: 937 Bytes
Contents
require 'yaml' module Bibliothecary module Parsers class Shard include Bibliothecary::Analyser def self.mapping { /^shard\.yml$/i => :parse_yaml_manifest, /^shard\.lock$/i => :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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bibliothecary-5.0.2 | lib/bibliothecary/parsers/shard.rb |
bibliothecary-5.0.1 | lib/bibliothecary/parsers/shard.rb |
bibliothecary-5.0.0 | lib/bibliothecary/parsers/shard.rb |