Sha256: a21f5d231a6621d310695b6054bc492a46a3e9d0b6a6362a9dd1caa630b8dd6b
Contents?: true
Size: 1.1 KB
Versions: 3
Compression:
Stored size: 1.1 KB
Contents
require 'toml' module Bibliothecary module Parsers class Cargo include Bibliothecary::Analyser def self.mapping { /Cargo\.toml$/ => :parse_manifest, /Cargo\.lock$/ => :parse_lockfile } end def self.parse_manifest(file_contents) manifest = TOML.parse(file_contents) manifest.fetch('dependencies', []).map do |name, requirement| if requirement.respond_to?(:fetch) requirement = requirement['version'] or next end { name: name, requirement: requirement, type: 'runtime' } end .compact end def self.parse_lockfile(file_contents) manifest = TOML.parse(file_contents) manifest.fetch('package',[]).map do |dependency| next if not dependency['source'] or not dependency['source'].start_with?('registry+') { name: dependency['name'], requirement: dependency['version'], type: 'runtime' } end .compact end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bibliothecary-5.0.2 | lib/bibliothecary/parsers/cargo.rb |
bibliothecary-5.0.1 | lib/bibliothecary/parsers/cargo.rb |
bibliothecary-5.0.0 | lib/bibliothecary/parsers/cargo.rb |