bibliothecary 6.9.6 → 6.10.3

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: 2d401e2ee48b3c9ea14b1ced4582ca501b5215bfd32283cbfa22ea6a3a013285
4
- data.tar.gz: 28872324cf699eea26ac419cec67fba683bc75be6b335943471a82854b762109
3
+ metadata.gz: af1a007a1d21ef7ecfeffcbe97319185c31da96d252f27a58619e60afcc3faf8
4
+ data.tar.gz: 64fb93438b9f3af750b2d69206ec7601e52b77bb5236a2783ad724a064125f33
5
5
  SHA512:
6
- metadata.gz: dbe0b6dd4065ea9fadf9c2458988fde20d7198d1142dca84460191704e2a7e61e1f9e6d96bd088424fcc5386be6e2b6b9dae479f40bebd03f328d6c623e02140
7
- data.tar.gz: 189db2576879293749a94eba6dbcef993e822e0d3fc26ac5e7b8d6de405ac7eb2ae6e513166428197bc6e6f0e718a6bd810d66f24f21cc60bf2ff2f3c25ac82a
6
+ metadata.gz: f4816e56d6cea72b20deaa2f2832a27ce1c2d99ffe5ac224e7259bb3595b699083ec32dbd2b2b756ec0ea8c82aa411908f4ab83eed366e41726f5d634e241630
7
+ data.tar.gz: 1f5c52f3c4ad451a2c32e93bc129694580bb7f1c5af8769e859cfcc74ee928ea8a3ed0595c84c7a5ff13bad118ce4ff02bd519ee12bdd7c5f688dc2e98076e17
data/bin/console CHANGED
@@ -10,5 +10,5 @@ require "bibliothecary"
10
10
  # require "pry"
11
11
  # Pry.start
12
12
 
13
- require "irb"
14
- IRB.start
13
+ require "pry"
14
+ Pry.start
@@ -60,6 +60,10 @@ module Bibliothecary
60
60
  match_filename("sbt-update-full.txt", case_insensitive: true) => {
61
61
  kind: 'lockfile',
62
62
  parser: :parse_sbt_update_full
63
+ },
64
+ match_filename("maven-dependency-tree.txt", case_insensitive: true) => {
65
+ kind: 'lockfile',
66
+ parser: :parse_maven_tree
63
67
  }
64
68
  }
65
69
  end
@@ -148,6 +152,25 @@ module Bibliothecary
148
152
  .compact
149
153
  .uniq
150
154
  end
155
+ def self.parse_maven_tree(file_contents)
156
+ file_contents = file_contents.gsub(/\r\n?/, "\n")
157
+ captures = file_contents.scan(/^\[INFO\][\s|+-\\]+([[\w.-]+:]+)(?=$|\s\(optional\)$)/).flatten.uniq
158
+ captures.map do |item|
159
+ parts = item.split(":")
160
+ case parts.count
161
+ when 4
162
+ version = parts[-1]
163
+ type = parts[-2]
164
+ when 5..6
165
+ version, type = parts[-2..]
166
+ end
167
+ {
168
+ name: parts[0..1].join(":"),
169
+ requirement: version,
170
+ type: type
171
+ }
172
+ end
173
+ end
151
174
 
152
175
  def self.parse_resolved_dep_line(line)
153
176
  dep_parts = line.strip.split(":")
@@ -201,7 +224,7 @@ module Bibliothecary
201
224
  return nil if field.nil?
202
225
 
203
226
  value = field.nodes.first
204
- match = value.match(MAVEN_PROPERTY_REGEX)
227
+ match = value&.match(MAVEN_PROPERTY_REGEX)
205
228
  if match
206
229
  return extract_property(xml, match[1], value, parent_properties)
207
230
  else
@@ -93,10 +93,16 @@ module Bibliothecary
93
93
 
94
94
  def self.parse_csproj(file_contents)
95
95
  manifest = Ox.parse file_contents
96
+
96
97
  packages = manifest.locate('ItemGroup/PackageReference').map do |dependency|
98
+ requirement = (dependency.Version if dependency.respond_to? "Version") || "*"
99
+ if requirement.is_a?(Ox::Element)
100
+ requirement = dependency.nodes.detect{ |n| n.value == "Version" }&.text
101
+ end
102
+
97
103
  {
98
104
  name: dependency.Include,
99
- requirement: (dependency.Version if dependency.respond_to? "Version") || "*",
105
+ requirement: requirement,
100
106
  type: 'runtime'
101
107
  }
102
108
  end
@@ -1,3 +1,3 @@
1
1
  module Bibliothecary
2
- VERSION = "6.9.6"
2
+ VERSION = "6.10.3"
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.9.6
4
+ version: 6.10.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Nesbitt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-22 00:00:00.000000000 Z
11
+ date: 2021-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: toml-rb
@@ -288,7 +288,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
288
288
  - !ruby/object:Gem::Version
289
289
  version: '0'
290
290
  requirements: []
291
- rubygems_version: 3.1.2
291
+ rubygems_version: 3.0.3
292
292
  signing_key:
293
293
  specification_version: 4
294
294
  summary: Find and parse manifests