blob: cd785b423448c4034566ad2cf4dae1a13486e57b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# frozen_string_literal: true
module License
module Management
class Nuspec
attr_reader :xml
def initialize(xml)
@xml = REXML::Document.new(xml)
end
def licenses
licenses = REXML::XPath.match(xml, "//package/metadata/license[@type='expression']").map(&:get_text).map(&:to_s)
return licenses if licenses.any?
REXML::XPath.match(xml, '//package/metadata/licenseUrl').map(&:get_text).map(&:to_s)
end
end
end
end
|