Sha256: e6a294bd3c8c819cc51cc6736df00de7f708f7eb7fc42b8ffa0dbafaaab1634b
Contents?: true
Size: 1003 Bytes
Versions: 3
Compression:
Stored size: 1003 Bytes
Contents
require 'json' module Bibliothecary module Parsers class Elm include Bibliothecary::Analyser def self.mapping { /^elm-package\.json$|^elm_dependencies\.json$/ => :parse_json_manifest, /^elm-stuff\/exact-dependencies\.json$/ => :parse_json_lock } end def self.parse_json_manifest(file_contents) manifest = JSON.parse file_contents map_dependencies(manifest, 'dependencies', 'runtime') end def self.parse_json_lock(file_contents) manifest = JSON.parse file_contents manifest.map do |name, requirement| { name: name, requirement: requirement, type: 'runtime' } end 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bibliothecary-5.0.2 | lib/bibliothecary/parsers/elm.rb |
bibliothecary-5.0.1 | lib/bibliothecary/parsers/elm.rb |
bibliothecary-5.0.0 | lib/bibliothecary/parsers/elm.rb |