Sha256: fdaac9a5d1fa0ff32cfeeeddf9a54e2ed0bc938a017234d4138d0eb19499bebb
Contents?: true
Size: 1.15 KB
Versions: 41
Compression:
Stored size: 1.15 KB
Contents
require 'json' module Bibliothecary module Parsers class Packagist include Bibliothecary::Analyser def self.mapping { match_filename("composer.json") => { kind: 'manifest', parser: :parse_manifest }, match_filename("composer.lock") => { kind: 'lockfile', parser: :parse_lockfile } } end def self.parse_lockfile(file_contents) manifest = JSON.parse file_contents manifest.fetch('packages',[]).map do |dependency| { name: dependency["name"], requirement: dependency["version"], type: 'runtime' } end + manifest.fetch('packages-dev',[]).map do |dependency| { name: dependency["name"], requirement: dependency["version"], type: 'development' } end end def self.parse_manifest(file_contents) manifest = JSON.parse file_contents map_dependencies(manifest, 'require', 'runtime') + map_dependencies(manifest, 'require-dev', 'development') end end end end
Version data entries
41 entries across 41 versions & 1 rubygems