bibliothecary 6.7.1 → 6.7.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 49fa537a10ec86b1e5ea5e98a309809ce5d48f86d6446f4b7594c4336f093fba
4
- data.tar.gz: 3114585dbb5202247403c9935f805666313f5e721d10a0ce7afdeb11bc22c725
3
+ metadata.gz: 132a90ea8ed661b70e6709542f66d899eb5e35900905fd353b63f4e70b535ef8
4
+ data.tar.gz: 3803d75c592a1f338ea4ce0d054b1347d3a61d35db14098427a5f94031b29bfd
5
5
  SHA512:
6
- metadata.gz: a022471cd15a016c117fb44ccd599431b1795551ca084a2e114d7ffb5a13b33c9eba9c83c56c2748237ff00a6e0a512fa090cec684c08fb09b5ddb304959d87e
7
- data.tar.gz: 555ae7a41a2757ce8a119f74fe9975aa9b40b75e8089ca2a9e18863b69bba93757e0f83236651893a8ba8356170d20242ac433be6873c91acabdf351564fadfc
6
+ metadata.gz: 26d770f760a52e56f7b51a04dadae781c87e73cac8e3f31d1f7cfd5d93c1a5597f079e609393146d7549b93a84bfb82a93801eacb92eb4cdf43f65e766e612ca
7
+ data.tar.gz: 1c8136abb0ad7b67a57b0e5e41f2e9a48e110e5c71b27baa6005c922f9fac30a69be173ec88aa20d3e494c96360986052210be0e07df0c652d15cc6f43affc34
@@ -109,16 +109,16 @@ module Bibliothecary
109
109
  end.compact.uniq {|item| [item[:name], item[:requirement], item[:type]]}
110
110
  end
111
111
 
112
- def self.parse_pom_manifest(file_contents)
112
+ def self.parse_pom_manifest(file_contents, parent_properties = {})
113
113
  manifest = Ox.parse file_contents
114
114
  xml = manifest.respond_to?('project') ? manifest.project : manifest
115
115
  [].tap do |deps|
116
116
  ['dependencies/dependency', 'dependencyManagement/dependencies/dependency'].each do |deps_xpath|
117
117
  xml.locate(deps_xpath).each do |dep|
118
118
  deps.push({
119
- name: "#{extract_pom_dep_info(xml, dep, 'groupId')}:#{extract_pom_dep_info(xml, dep, 'artifactId')}",
120
- requirement: extract_pom_dep_info(xml, dep, 'version'),
121
- type: extract_pom_dep_info(xml, dep, 'scope') || 'runtime'
119
+ name: "#{extract_pom_dep_info(xml, dep, 'groupId', parent_properties)}:#{extract_pom_dep_info(xml, dep, 'artifactId', parent_properties)}",
120
+ requirement: extract_pom_dep_info(xml, dep, 'version', parent_properties),
121
+ type: extract_pom_dep_info(xml, dep, 'scope', parent_properties) || 'runtime'
122
122
  })
123
123
  end
124
124
  end
@@ -141,16 +141,30 @@ module Bibliothecary
141
141
  end.compact
142
142
  end
143
143
 
144
- def self.extract_pom_dep_info(xml, dependency, name)
144
+ def self.extract_pom_info(xml, location, parent_properties = {})
145
+ extract_pom_dep_info(xml, xml, location, parent_properties)
146
+ end
147
+
148
+ def self.extract_pom_dep_info(xml, dependency, name, parent_properties = {})
145
149
  field = dependency.locate(name).first
146
150
  return nil if field.nil?
147
151
  value = field.nodes.first
148
152
  match = value.match(/^\$\{(.+)\}/)
149
153
  if match
150
- return value unless xml.respond_to? 'properties'
154
+ # the xml root is <project> so lookup the non property name in the xml
155
+ # this converts ${project/group.id} -> ${group/id}
156
+ non_prop_name = match[1].gsub('.', '/').gsub('project/', '')
157
+ return value if !xml.respond_to?('properties') && parent_properties.empty? && !xml.locate(non_prop_name)
151
158
  prop_field = xml.properties.locate(match[1]).first
159
+ parent_prop = parent_properties[match[1]]
152
160
  if prop_field
153
161
  return prop_field.nodes.first
162
+ elsif parent_prop
163
+ return parent_prop
164
+ elsif xml.locate(non_prop_name).first
165
+ # see if the value to look up is a field under the project
166
+ # examples are ${project.groupId} or ${project.version}
167
+ return xml.locate(non_prop_name).first.nodes.first
154
168
  else
155
169
  return value
156
170
  end
@@ -1,3 +1,3 @@
1
1
  module Bibliothecary
2
- VERSION = "6.7.1"
2
+ VERSION = "6.7.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bibliothecary
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.7.1
4
+ version: 6.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Nesbitt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-29 00:00:00.000000000 Z
11
+ date: 2019-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: toml-rb
@@ -273,8 +273,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
273
273
  - !ruby/object:Gem::Version
274
274
  version: '0'
275
275
  requirements: []
276
- rubyforge_project:
277
- rubygems_version: 2.7.6
276
+ rubygems_version: 3.0.3
278
277
  signing_key:
279
278
  specification_version: 4
280
279
  summary: Find and parse manifests