13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/brew_dg/dependency_manifest.rb', line 13
def self.from_output(line)
type_match = line.match(/^(\w+):/)
type = type_match && type_match.captures.first
if DEPENDENCY_TYPES.include?(type)
= "#{type}: "
manifest_parts = line.split()
if manifest_parts.size == 2
manifest_body = manifest_parts.last
dependencies = manifest_body.split(', ').map do |dependency|
dependency.scan(/\w|\s|-|_/).join.strip
end
else
dependencies = []
end
new(type: type.downcase.intern, dependencies: dependencies)
end
end
|