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

rubocop:disable Lint/UnusedMethodArgument



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

def self.parse_conda(file_contents, options: {}) # rubocop:disable Lint/UnusedMethodArgument
  parse_conda_with_kind(file_contents, "manifest")
end

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

rubocop:disable Lint/UnusedMethodArgument



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

def self.parse_conda_lockfile(file_contents, options: {}) # rubocop:disable Lint/UnusedMethodArgument
  parse_conda_with_kind(file_contents, "lockfile")
end

.parse_conda_with_kind(info, kind) ⇒ Object



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

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