bibliothecary 6.9.7 → 6.10.4

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: 127bb145341b9464e7c551a835ce172f3791a065081940de00e9cdddd5a16aec
4
- data.tar.gz: 12db3fb6e30ee437182d56768428b51b0f7c3473bb818922fb1310865b3c4f40
3
+ metadata.gz: a0fe6cf7ec6515474ae77b8675dce1e61fc29d66a7f01603cbd3d47da401810f
4
+ data.tar.gz: cd9653505a89fe19e9524d980e845046c043e3d6147f9139a77f24f206ad5496
5
5
  SHA512:
6
- metadata.gz: ba78060a9d3793cd2251181404d1d354b3e1c968c77b470201cdb5e94a1bc1a13f7c68d9b4ecc460c43f06550e3e9d433b3206569bf188d9acf1a1191e095c13
7
- data.tar.gz: d8e20b2df9b305570f252cd1c403248e178c0a489b8180a10dbfc13a2a6e0e31af588508671c9c4286589c2e560d84b59a168c40e427ea3751433e0c4e9f8901
6
+ metadata.gz: c3260f87303449999f892cb1f7a860eed43755800310772f2e4a2a55676f54a3170e2099da31a373ab1a3be31640101f2a830e76556552e8e16dd857337a290e
7
+ data.tar.gz: 9d11c0d38c59222971e4515089f7a44e5e90379e9317d4176a54d6303131d8d30ff90ac23b069533f5b1556f11cf2bf5a9c53b867ebf5f088b44ea283d5f4c4b
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\.-]+:)+[\w\.\-]+)/).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(":")
@@ -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.7"
2
+ VERSION = "6.10.4"
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.7
4
+ version: 6.10.4
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-29 00:00:00.000000000 Z
11
+ date: 2021-03-19 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