Class: Bibliothecary::Parsers::Carthage
- Inherits:
-
Object
- Object
- Bibliothecary::Parsers::Carthage
- Includes:
- Analyser
- Defined in:
- lib/bibliothecary/parsers/carthage.rb
Class Method Summary collapse
- .map_dependencies(manifest, path) ⇒ Object
- .mapping ⇒ Object
-
.parse_cartfile(file_contents, options: {}) ⇒ Object
rubocop:disable Lint/UnusedMethodArgument.
-
.parse_cartfile_private(file_contents, options: {}) ⇒ Object
rubocop:disable Lint/UnusedMethodArgument.
-
.parse_cartfile_resolved(file_contents, options: {}) ⇒ Object
rubocop:disable Lint/UnusedMethodArgument.
Methods included from Analyser
create_analysis, create_error_analysis, included
Class Method Details
.map_dependencies(manifest, path) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 |
# 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 ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# 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: {}) ⇒ Object
rubocop:disable Lint/UnusedMethodArgument
25 26 27 |
# 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: {}) ⇒ Object
rubocop:disable Lint/UnusedMethodArgument
29 30 31 |
# 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: {}) ⇒ Object
rubocop:disable Lint/UnusedMethodArgument
33 34 35 |
# 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 |