Sha256: 70f5e18c1a21ee95b4cdd8b0bd010b4dabe1b2ec1cd4acbd335c7be2c8c1d9b2

Contents?: true

Size: 830 Bytes

Versions: 5

Compression:

Stored size: 830 Bytes

Contents

require 'json'

module Bibliothecary
  module Parsers
    class Elm
      include Bibliothecary::Analyser
      extend Bibliothecary::MultiParsers::JSONRuntime

      def self.mapping
        {
          match_filenames("elm-package.json", "elm_dependencies.json") => {
            kind: 'manifest',
            parser: :parse_json_runtime_manifest
          },
          match_filename("elm-stuff/exact-dependencies.json") => {
            kind: 'lockfile',
            parser: :parse_json_lock
          }
        }
      end

      def self.parse_json_lock(file_contents, options: {})
        manifest = JSON.parse file_contents
        manifest.map do |name, requirement|
          {
            name: name,
            requirement: requirement,
            type: 'runtime'
          }
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bibliothecary-8.2.1 lib/bibliothecary/parsers/elm.rb
bibliothecary-8.2.0 lib/bibliothecary/parsers/elm.rb
bibliothecary-8.1.1 lib/bibliothecary/parsers/elm.rb
bibliothecary-8.1.0 lib/bibliothecary/parsers/elm.rb
bibliothecary-8.0.0 lib/bibliothecary/parsers/elm.rb