Sha256: e243655392098a747993cf39eecfa12cc62986182478f04b68075e2d35643252

Contents?: true

Size: 833 Bytes

Versions: 3

Compression:

Stored size: 833 Bytes

Contents

require 'json'

module Bibliothecary
  module Parsers
    class Elm
      include Bibliothecary::Analyser

      def self.mapping
        {
          /(^elm-package\.json$|^elm_dependencies\.json$|.*\/elm-package\.json$|.*\/elm_dependencies\.json$)/ => {
            kind: 'manifest',
            parser: :parse_json_runtime_manifest
          },
          /(^elm-stuff\/exact-dependencies\.json$|.*\/elm-stuff\/exact-dependencies\.json$)/ => {
            kind: 'lockfile',
            parser: :parse_json_lock
          }
        }
      end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bibliothecary-6.3.2 lib/bibliothecary/parsers/elm.rb
bibliothecary-6.3.1 lib/bibliothecary/parsers/elm.rb
bibliothecary-6.3.0 lib/bibliothecary/parsers/elm.rb