class Bibliothecary::Parsers::CocoaPods
Constants
- NAME_VERSION
- NAME_VERSION_4
Public Class Methods
mapping()
click to toggle source
# File lib/bibliothecary/parsers/cocoapods.rb, line 13 def self.mapping { match_filename("Podfile") => { kind: "manifest", parser: :parse_podfile, }, match_extension(".podspec") => { kind: "manifest", parser: :parse_podspec, can_have_lockfile: false, }, match_filename("Podfile.lock") => { kind: "lockfile", parser: :parse_podfile_lock, }, match_extension(".podspec.json") => { kind: "manifest", parser: :parse_json_manifest, can_have_lockfile: false, }, } end
parse_json_manifest(file_contents, options: {})
click to toggle source
# File lib/bibliothecary/parsers/cocoapods.rb, line 61 def self.parse_json_manifest(file_contents, options: {}) # rubocop:disable Lint/UnusedMethodArgument manifest = JSON.parse(file_contents) manifest["dependencies"].inject([]) do |deps, dep| deps.push(Dependency.new( name: dep[0], requirement: dep[1], type: "runtime", )) end.uniq end
parse_podfile(file_contents, options: {})
click to toggle source
# File lib/bibliothecary/parsers/cocoapods.rb, line 56 def self.parse_podfile(file_contents, options: {}) # rubocop:disable Lint/UnusedMethodArgument manifest = Gemnasium::Parser.send(:podfile, file_contents) parse_ruby_manifest(manifest) end
parse_podfile_lock(file_contents, options: {})
click to toggle source
# File lib/bibliothecary/parsers/cocoapods.rb, line 38 def self.parse_podfile_lock(file_contents, options: {}) # rubocop:disable Lint/UnusedMethodArgument manifest = YAML.load file_contents manifest["PODS"].map do |row| pod = row.is_a?(String) ? row : row.keys.first match = pod.match(/(.+?)\s\((.+?)\)/i) Dependency.new( name: match[1].split("/").first, requirement: match[2], type: "runtime", ) end.compact end
parse_podspec(file_contents, options: {})
click to toggle source
# File lib/bibliothecary/parsers/cocoapods.rb, line 51 def self.parse_podspec(file_contents, options: {}) # rubocop:disable Lint/UnusedMethodArgument manifest = Gemnasium::Parser.send(:podspec, file_contents) parse_ruby_manifest(manifest) end