Sha256: 9409acb3be963a272e1f24879a33b6d7a90b4a60cd87aef3469b6b3abac0518a

Contents?: true

Size: 627 Bytes

Versions: 3

Compression:

Stored size: 627 Bytes

Contents

require 'json'

module Bibliothecary
  module Parsers
    class Meteor
      include Bibliothecary::Analyser

      def self.mapping
        {
          /^versions\.json$/ => :parse_manifest
        }
      end

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bibliothecary-5.0.2 lib/bibliothecary/parsers/meteor.rb
bibliothecary-5.0.1 lib/bibliothecary/parsers/meteor.rb
bibliothecary-5.0.0 lib/bibliothecary/parsers/meteor.rb