bibliothecary 6.9.4 → 6.10.1

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: f57d8637d49aae8bd8f583109656fb0d350cfc158fc1361ed7402d3a6fba99e1
4
- data.tar.gz: b85cb6e9c207463d3fa866c6ce5f9d2e6fd9f53db5da13ed1a7ef3d692bf8c63
3
+ metadata.gz: f69e23d022b216f39433b7628672b1ba5556815ba5df6d96718280e8728f53c8
4
+ data.tar.gz: 80e4095a6325c6b6589b1ce7be6fbe290b238522d81a45b7faceb462f5167a2c
5
5
  SHA512:
6
- metadata.gz: 1a7983ac7b9dfb8b17bab91a9a30afce59dc4ae0b7c6c9259eadd2bd0dfb4354aa77a01193bd02737c4bf57c3b58ab2c7c2ad44c3106eef4a5a3e9a377a336fa
7
- data.tar.gz: a824e5fb5bcba3393c4f75e26a79c63b75127419777b287a1e3870a659b1d35b345e40fb7a4e19a3cffbc98b72543eac0d27f9c3064f1006f6200d6e2f0be1e5
6
+ metadata.gz: 9c6f9d2e2fa68ead83476b974595eb4e6251cd27b8f72751e928e39607dd6184f74e0c5c367bd058a8772195c533b1f4c07d3b72c4fd4d8582464ebc5e38834b
7
+ data.tar.gz: ed8ab5fe2320cda2c4decddeaf0b4442169a91f8369e9ee1ca8fda56724aed8117613f2fbbd33503ec51d8288aa66844aa56c12ff4c2e15d90d37457efd8d423
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,16 @@ module Bibliothecary
144
152
  .compact
145
153
  .uniq
146
154
  end
155
+ def self.parse_maven_tree(file_contents)
156
+ captures = file_contents.scan(/\s([\w.-]+:[\w.-]+:[\w.-]+:[\w.-]+:[a-zA-Z]+)/).flatten.uniq
157
+ captures.map do |item|
158
+ {
159
+ name: item.split(":")[0..1].join(":"),
160
+ requirement: item.split(":")[3],
161
+ type: item.split(":")[-1]
162
+ }
163
+ end
164
+ end
147
165
 
148
166
  def self.parse_resolved_dep_line(line)
149
167
  dep_parts = line.strip.split(":")
@@ -197,7 +215,7 @@ module Bibliothecary
197
215
  return nil if field.nil?
198
216
 
199
217
  value = field.nodes.first
200
- match = value.match(MAVEN_PROPERTY_REGEX)
218
+ match = value&.match(MAVEN_PROPERTY_REGEX)
201
219
  if match
202
220
  return extract_property(xml, match[1], value, parent_properties)
203
221
  else
@@ -70,10 +70,12 @@ module Bibliothecary
70
70
  if frameworks.size > 0
71
71
  # we should really return multiple manifests, but bibliothecary doesn't
72
72
  # do that yet so at least pick deterministically.
73
- frameworks[frameworks.keys.sort.last]
74
- else
75
- []
73
+
74
+ # Note, frameworks can be empty, so remove empty ones and then return the last sorted item if any
75
+ frameworks = frameworks.delete_if { |k, v| v.empty? }
76
+ return frameworks[frameworks.keys.sort.last] unless frameworks.empty?
76
77
  end
78
+ []
77
79
  end
78
80
 
79
81
  def self.parse_packages_config(file_contents)
@@ -91,10 +93,16 @@ module Bibliothecary
91
93
 
92
94
  def self.parse_csproj(file_contents)
93
95
  manifest = Ox.parse file_contents
96
+
94
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
+
95
103
  {
96
104
  name: dependency.Include,
97
- requirement: (dependency.Version if dependency.respond_to? "Version") || "*",
105
+ requirement: requirement,
98
106
  type: 'runtime'
99
107
  }
100
108
  end
@@ -1,3 +1,3 @@
1
1
  module Bibliothecary
2
- VERSION = "6.9.4"
2
+ VERSION = "6.10.1"
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.4
4
+ version: 6.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Nesbitt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-02 00:00:00.000000000 Z
11
+ date: 2021-03-16 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