class Bibliothecary::Parsers::Carthage
Public Class Methods
map_dependencies(manifest, path)
click to toggle source
# File lib/bibliothecary/parsers/carthage.rb, line 37 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| Dependency.new( name: dependency["name"], requirement: dependency["version"], type: dependency["type"], ) end end
mapping()
click to toggle source
# File lib/bibliothecary/parsers/carthage.rb, line 6 def self.mapping { match_filename("Cartfile") => { kind: "manifest", parser: :parse_cartfile, }, match_filename("Cartfile.private") => { kind: "manifest", parser: :parse_cartfile_private, }, match_filename("Cartfile.resolved") => { kind: "lockfile", parser: :parse_cartfile_resolved, }, } end
parse_cartfile(file_contents, options: {})
click to toggle source
# File lib/bibliothecary/parsers/carthage.rb, line 25 def self.parse_cartfile(file_contents, options: {}) # rubocop:disable Lint/UnusedMethodArgument map_dependencies(file_contents, "cartfile") end
parse_cartfile_private(file_contents, options: {})
click to toggle source
# File lib/bibliothecary/parsers/carthage.rb, line 29 def self.parse_cartfile_private(file_contents, options: {}) # rubocop:disable Lint/UnusedMethodArgument map_dependencies(file_contents, "cartfile.private") end
parse_cartfile_resolved(file_contents, options: {})
click to toggle source
# File lib/bibliothecary/parsers/carthage.rb, line 33 def self.parse_cartfile_resolved(file_contents, options: {}) # rubocop:disable Lint/UnusedMethodArgument map_dependencies(file_contents, "cartfile.resolved") end