bibliothecary 6.9.5 → 6.10.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: 7b4f1697f4fcbba2dcb21acb917705fa323f711cb9d8228b0bd4910ea629ba40
4
- data.tar.gz: e25145a37b29d74198e51b73e4c00eeeb9b0b2b09adc365ac523714bc4d79055
3
+ metadata.gz: 4da554e866567459e3e2dea24812aa193288f913f7fd32bf2ccb65bb3d331106
4
+ data.tar.gz: 4125918d570e46d9076d11abff2f12e80168b9439b3a4c49c0c494367c089c52
5
5
  SHA512:
6
- metadata.gz: b390db66abe4a3cc89a88574aafb202c5c8b94847a41eac5d0749360e9d1f61c96cd2e332a5a793e6f69fa0ee39ab8874581941ca083e9d6685c6237977122f3
7
- data.tar.gz: 004ad44ccac55b16fb434a22b62785f57b7de51947f2ea29f314261a2e35659ecdd3a99e96f10fca90ac9821d62e9a148ad6442b1e8754f6c23aedc12318f643
6
+ metadata.gz: 39777e9b798d1b8acc1ca64c7148122e195539ed05aa960bdc9bd851b92c455ba0289a3b48820385d65c31b3b9b63ddf14060a80bc808f1ce676eebe64562a4b
7
+ data.tar.gz: 558180871bb9e340c0dd46239b82d976ff39884f56a8a7aedf483422c2182af1ea179c275387188c622a7dbc07a3fdb3d58a75a3e0aeacddea06f0bf13296643
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
@@ -126,11 +130,15 @@ module Bibliothecary
126
130
  # org.springframework.boot:spring-boot-starter-web:2.1.0.M3 (*)
127
131
  # Lines can end with (c), (n), or (*)
128
132
  # to indicate that something was a dependency constraint (c), not resolved (n), or resolved previously (*).
129
- dep = line.split(split)[1].sub(/(\((c|n|\*)\))$/, "").strip.split(":")
133
+ dep = line.split(split)[1].sub(/(\((c|n|\*)\))$/, "").sub(" -> ", ":").strip.split(":")
134
+
135
+ # A testImplementation line can look like this so just skip those
136
+ # \--- org.springframework.security:spring-security-test (n)
137
+ next unless dep.length >= 3
138
+
130
139
  version = dep[-1]
131
- version = version.split("->")[-1].strip if line.include?("->")
132
140
  {
133
- name: dep[0, dep.length - 1].join(":"),
141
+ name: dep[0..1].join(":"),
134
142
  requirement: version,
135
143
  type: type
136
144
  }
@@ -144,6 +152,24 @@ module Bibliothecary
144
152
  .compact
145
153
  .uniq
146
154
  end
155
+ def self.parse_maven_tree(file_contents)
156
+ captures = file_contents.scan(/^\[INFO\][\s|+-\\]+([[\w.-]+:]+)(?=$|\s\(optional\)$)/).flatten.uniq
157
+ captures.map do |item|
158
+ parts = item.split(":")
159
+ case parts.count
160
+ when 4
161
+ version = parts[-1]
162
+ type = parts[-2]
163
+ when 5..6
164
+ version, type = parts[-2..]
165
+ end
166
+ {
167
+ name: parts[0..1].join(":"),
168
+ requirement: version,
169
+ type: type
170
+ }
171
+ end
172
+ end
147
173
 
148
174
  def self.parse_resolved_dep_line(line)
149
175
  dep_parts = line.strip.split(":")
@@ -197,7 +223,7 @@ module Bibliothecary
197
223
  return nil if field.nil?
198
224
 
199
225
  value = field.nodes.first
200
- match = value.match(MAVEN_PROPERTY_REGEX)
226
+ match = value&.match(MAVEN_PROPERTY_REGEX)
201
227
  if match
202
228
  return extract_property(xml, match[1], value, parent_properties)
203
229
  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.5"
2
+ VERSION = "6.10.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.9.5
4
+ version: 6.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Nesbitt
8
- autorequire:
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
@@ -206,7 +206,7 @@ dependencies:
206
206
  - - ">="
207
207
  - !ruby/object:Gem::Version
208
208
  version: '0'
209
- description:
209
+ description:
210
210
  email:
211
211
  - andrewnez@gmail.com
212
212
  executables:
@@ -273,7 +273,7 @@ homepage: https://github.com/librariesio/bibliothecary
273
273
  licenses:
274
274
  - AGPL-3.0
275
275
  metadata: {}
276
- post_install_message:
276
+ post_install_message:
277
277
  rdoc_options: []
278
278
  require_paths:
279
279
  - lib
@@ -288,8 +288,8 @@ 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
292
- signing_key:
291
+ rubygems_version: 3.0.3
292
+ signing_key:
293
293
  specification_version: 4
294
294
  summary: Find and parse manifests
295
295
  test_files: []