Sha256: 78cda66a6471a16c9826626b3a2550f1aec8e03a53c3d43d05326301ad02b950

Contents?: true

Size: 737 Bytes

Versions: 14

Compression:

Stored size: 737 Bytes

Contents

require 'json'

module Bibliothecary
  module Parsers
    class Elm
      include Bibliothecary::Analyser

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

14 entries across 14 versions & 1 rubygems

Version Path
bibliothecary-6.2.1 lib/bibliothecary/parsers/elm.rb
bibliothecary-6.2.0 lib/bibliothecary/parsers/elm.rb
bibliothecary-6.1.0 lib/bibliothecary/parsers/elm.rb
bibliothecary-6.0.0 lib/bibliothecary/parsers/elm.rb
bibliothecary-5.6.2 lib/bibliothecary/parsers/elm.rb
bibliothecary-5.6.1 lib/bibliothecary/parsers/elm.rb
bibliothecary-5.6.0 lib/bibliothecary/parsers/elm.rb
bibliothecary-5.5.5 lib/bibliothecary/parsers/elm.rb
bibliothecary-5.5.4 lib/bibliothecary/parsers/elm.rb
bibliothecary-5.5.3 lib/bibliothecary/parsers/elm.rb
bibliothecary-5.5.2 lib/bibliothecary/parsers/elm.rb
bibliothecary-5.5.1 lib/bibliothecary/parsers/elm.rb
bibliothecary-5.5.0 lib/bibliothecary/parsers/elm.rb
bibliothecary-5.4.0 lib/bibliothecary/parsers/elm.rb