Sha256: 025128f437b126f036c508555ee867e5cba1c065f67ebb383cd922db921615f3
Contents?: true
Size: 925 Bytes
Versions: 7
Compression:
Stored size: 925 Bytes
Contents
require 'json' require 'sdl_parser' module Bibliothecary module Parsers class Dub include Bibliothecary::Analyser def self.mapping { /^dub\.json$/ => { kind: 'manifest', parser: :parse_manifest }, /^dub\.sdl$/ => { kind: 'manifest', parser: :parse_sdl_manifest } } end def self.parse_manifest(file_contents) manifest = JSON.parse(file_contents) map_dependencies(manifest, 'dependencies', 'runtime') end def self.parse_sdl_manifest(manifest) SdlParser.new(:runtime, manifest).dependencies end def self.map_dependencies(hash, key, type) hash.fetch(key,[]).map do |name, requirement| { name: name, requirement: requirement, type: type } end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems