Class: Bibliothecary::Parsers::Meteor

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

Class Method Summary collapse

Methods included from Analyser

included

Class Method Details

.map_dependencies(hash, key, type) ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'lib/bibliothecary/parsers/meteor.rb', line 22

def self.map_dependencies(hash, key, type)
  hash.fetch(key,[]).map do |name, requirement|
    {
      name: name,
      requirement: requirement,
      type: type
    }
  end
end

.mappingObject



8
9
10
11
12
13
14
15
# File 'lib/bibliothecary/parsers/meteor.rb', line 8

def self.mapping
  {
    /^versions\.json$/ => {
      kind: 'manifest',
      parser: :parse_manifest
    }
  }
end

.parse_manifest(file_contents) ⇒ Object



17
18
19
20
# File 'lib/bibliothecary/parsers/meteor.rb', line 17

def self.parse_manifest(file_contents)
  manifest = JSON.parse(file_contents)
  map_dependencies(manifest, 'dependencies', 'runtime')
end