Sha256: 811abd4b90d217414ae70c84b456c0207475106d1771033d8c6da4237576e20d
Contents?: true
Size: 1.49 KB
Versions: 56
Compression:
Stored size: 1.49 KB
Contents
require 'json' module Bibliothecary module Parsers class Hex include Bibliothecary::Analyser def self.mapping { match_filename("mix.exs") => { kind: 'manifest', parser: :parse_mix }, match_filename("mix.lock") => { kind: 'lockfile', parser: :parse_mix_lock } } end def self.parse_mix(manifest) response = Typhoeus.post("#{Bibliothecary.configuration.mix_parser_host}/", body: manifest) raise Bibliothecary::RemoteParsingError.new("Http Error #{response.response_code} when contacting: #{Bibliothecary.configuration.mix_parser_host}/", response.response_code) unless response.success? json = JSON.parse response.body json.map do |name, version| { name: name, requirement: version, type: "runtime" } end end def self.parse_mix_lock(manifest) response = Typhoeus.post("#{Bibliothecary.configuration.mix_parser_host}/lock", body: manifest) raise Bibliothecary::RemoteParsingError.new("Http Error #{response.response_code} when contacting: #{Bibliothecary.configuration.mix_parser_host}/", response.response_code) unless response.success? json = JSON.parse response.body json.map do |name, info| { name: name, requirement: info['version'], type: "runtime" } end end end end end
Version data entries
56 entries across 56 versions & 1 rubygems