Sha256: 75abb312b7639140d27a33ffb52c2c7637f3045e6ee04844a3aab23aede12bbc

Contents?: true

Size: 691 Bytes

Versions: 7

Compression:

Stored size: 691 Bytes

Contents

require 'json'

module Bibliothecary
  module Parsers
    class Meteor
      include Bibliothecary::Analyser

      def self.mapping
        {
          /^versions\.json$/ => {
            kind: 'manifest',
            parser: :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

7 entries across 7 versions & 1 rubygems

Version Path
bibliothecary-5.3.4 lib/bibliothecary/parsers/meteor.rb
bibliothecary-5.3.3 lib/bibliothecary/parsers/meteor.rb
bibliothecary-5.3.2 lib/bibliothecary/parsers/meteor.rb
bibliothecary-5.3.1 lib/bibliothecary/parsers/meteor.rb
bibliothecary-5.3.0 lib/bibliothecary/parsers/meteor.rb
bibliothecary-5.2.0 lib/bibliothecary/parsers/meteor.rb
bibliothecary-5.1.0 lib/bibliothecary/parsers/meteor.rb