Method: Bibliothecary::Parsers::Carthage.map_dependencies

Defined in:
lib/bibliothecary/parsers/carthage.rb

.map_dependencies(manifest, path) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/bibliothecary/parsers/carthage.rb', line 35

def self.map_dependencies(manifest, path)
  response = Typhoeus.post("#{Bibliothecary.configuration.carthage_parser_host}/#{path}", params: {body: manifest})
  raise Bibliothecary::RemoteParsingError.new("Http Error #{response.response_code} when contacting: #{Bibliothecary.configuration.carthage_parser_host}/#{path}", response.response_code) unless response.success?
  json = JSON.parse(response.body)

  json.map do |dependency|
    {
      name: dependency['name'],
      requirement: dependency['version'],
      type: dependency["type"]
    }
  end
end