Class: Bibliothecary::Parsers::Conda

Inherits:
Object
  • Object
show all
Includes:
Analyser
Defined in:
lib/bibliothecary/parsers/conda.rb

Class Method Summary collapse

Methods included from Analyser

create_analysis, create_error_analysis, included

Class Method Details

.mappingObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/bibliothecary/parsers/conda.rb', line 8

def self.mapping
  {
    match_filename("environment.yml") => {
      parser: :parse_conda,
      kind: "manifest"
    },
    match_filename("environment.yaml") => {
      parser: :parse_conda,
      kind: "manifest"
    },
    match_filename("environment.yml.lock") => {
      parser: :parse_conda_lockfile,
      kind: "lockfile"
    },
    match_filename("environment.yaml.lock") => {
      parser: :parse_conda_lockfile,
      kind: "lockfile"
    }
  }
end

.parse_conda(file_contents, options: {}) ⇒ Object



32
33
34
# File 'lib/bibliothecary/parsers/conda.rb', line 32

def self.parse_conda(file_contents, options: {})
  parse_conda_with_kind(file_contents, "manifest")
end

.parse_conda_lockfile(file_contents, options: {}) ⇒ Object



36
37
38
# File 'lib/bibliothecary/parsers/conda.rb', line 36

def self.parse_conda_lockfile(file_contents, options: {})
  parse_conda_with_kind(file_contents, "lockfile")
end

.parse_conda_with_kind(info, kind) ⇒ Object



40
41
42
43
# File 'lib/bibliothecary/parsers/conda.rb', line 40

def self.parse_conda_with_kind(info, kind)
  dependencies = call_conda_parser_web(info, kind)[kind.to_sym]
  dependencies.map { |dep| dep.merge(type: "runtime") }
end