class Bibliothecary::Parsers::CRAN
Constants
- REQUIRE_REGEXP
Public Class Methods
mapping()
click to toggle source
# File lib/bibliothecary/parsers/cran.rb, line 10 def self.mapping { match_filename("DESCRIPTION", case_insensitive: true) => { kind: "manifest", parser: :parse_description, }, } end
parse_description(file_contents, options: {})
click to toggle source
# File lib/bibliothecary/parsers/cran.rb, line 23 def self.parse_description(file_contents, options: {}) # rubocop:disable Lint/UnusedMethodArgument manifest = DebControl::ControlFileBase.parse(file_contents) parse_section(manifest, "Depends") + parse_section(manifest, "Imports") + parse_section(manifest, "Suggests") + parse_section(manifest, "Enhances") end
parse_section(manifest, name)
click to toggle source
# File lib/bibliothecary/parsers/cran.rb, line 31 def self.parse_section(manifest, name) return [] unless manifest.first[name] deps = manifest.first[name].delete("\n").split(",").map(&:strip) deps.map do |dependency| dep = dependency.match(REQUIRE_REGEXP) Dependency.new( name: dep[1], requirement: dep[2], type: name.downcase, ) end end