Sha256: 8d31bc2817b495d654e71c968c349d7627870309abbc265f84ade5a34a5c3cba
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true module Spandx module Python module Parsers class PipfileLock < ::Spandx::Core::Parser def match?(path) path.basename.fnmatch?('Pipfile*.lock') end def parse(lockfile) results = [] dependencies_from(lockfile) do |dependency| results << dependency end results end private def dependencies_from(lockfile) json = JSON.parse(lockfile.read) each_dependency(json) do |name, version| yield ::Spandx::Core::Dependency.new( path: lockfile, name: name, version: version, meta: json ) end end def each_dependency(json, groups: %w[default develop]) groups.each do |group| json[group].each do |name, value| yield name, canonicalize(value['version']) end end end def canonicalize(version) version.gsub(/==/, '') end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
spandx-0.13.4 | lib/spandx/python/parsers/pipfile_lock.rb |