bibliothecary 7.0.0 → 7.1.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: 527bb093daab817755bf4f5a3d35b1aa831f292f9fe8112ddf6a917b368239ac
4
- data.tar.gz: 37ffb251371c1aed5465e15e933dd41921f341ff4794da004d8678cda695cd25
3
+ metadata.gz: e99bd64be33f917579aeca0ce4d27a1290328020516f2bf2328f3bc82273da99
4
+ data.tar.gz: 3c431e57230c9d20ba3e66e4e5e9b72def9ba81ad8707f47166be5d9e993a751
5
5
  SHA512:
6
- metadata.gz: 6f67cfe62ca501f2ad8064e3fff37593e929d20d8210d619a57e88a887f4fc981081fb1cdc09e9e8b5ab582d22eb46e760b6f53456e9ecfb179a744a7c6b1d91
7
- data.tar.gz: 407398a4772816f145da883104d5a21516117fd8e544ecaff3e0dd438c26a02f8a17bc766e2c51a602ac72008c6954e16ee9478db2f80700d3ac47ebb6182858
6
+ metadata.gz: 722b6cad2fa9b84111fa97a5f925e6fb3967489bac80747e11ab1c6ac22cfec6a4fdeefa6e17ad9e926860e429322e1e1f182bfc88ea69a4778cfc0717d9de70
7
+ data.tar.gz: 0e92b678afe3f81ad3593f6feaa7e4357a4bda19e1ec4720a8f513c69261b87eb2916950b556ab645913432496b1153f8db7a44f3945baaa6e2154a0109fdd01
@@ -152,10 +152,12 @@ module Bibliothecary
152
152
  .compact
153
153
  .uniq
154
154
  end
155
+
155
156
  def self.parse_maven_tree(file_contents)
156
157
  file_contents = file_contents.gsub(/\r\n?/, "\n")
157
158
  captures = file_contents.scan(/^\[INFO\](?:(?:\+-)|\||(?:\\-)|\s)+((?:[\w\.-]+:)+[\w\.\-${}]+)/).flatten.uniq
158
- captures.map do |item|
159
+
160
+ deps = captures.map do |item|
159
161
  parts = item.split(":")
160
162
  case parts.count
161
163
  when 4
@@ -170,6 +172,10 @@ module Bibliothecary
170
172
  type: type
171
173
  }
172
174
  end
175
+
176
+ # First dep line will be the package itself (unless we're only analyzing a single line)
177
+ package = deps[0]
178
+ deps.size < 2 ? deps : deps[1..-1].reject { |d| d[:name] == package[:name] && d[:requirement] == package[:requirement] }
173
179
  end
174
180
 
175
181
  def self.parse_resolved_dep_line(line)
@@ -24,14 +24,20 @@ module Bibliothecary
24
24
  {
25
25
  name: dependency["name"],
26
26
  requirement: dependency["version"],
27
- type: 'runtime'
28
- }
27
+ type: "runtime"
28
+ }.tap do |result|
29
+ # Store Drupal version if Drupal, but include the original manifest version for reference
30
+ result[:original_requirement], result[:requirement] = result[:requirement], dependency.dig("source", "reference") if is_drupal_module(dependency)
31
+ end
29
32
  end + manifest.fetch('packages-dev',[]).map do |dependency|
30
33
  {
31
34
  name: dependency["name"],
32
35
  requirement: dependency["version"],
33
- type: 'development'
34
- }
36
+ type: "development"
37
+ }.tap do |result|
38
+ # Store Drupal version if Drupal, but include the original manifest version for reference
39
+ result[:original_requirement], result[:requirement] = result[:requirement], dependency.dig("source", "reference") if is_drupal_module(dependency)
40
+ end
35
41
  end
36
42
  end
37
43
 
@@ -40,6 +46,18 @@ module Bibliothecary
40
46
  map_dependencies(manifest, 'require', 'runtime') +
41
47
  map_dependencies(manifest, 'require-dev', 'development')
42
48
  end
49
+
50
+ # Drupal hosts its own Composer repository, where its "modules" are indexed and searchable. The best way to
51
+ # confirm that Drupal's repo is being used is if its in the "repositories" in composer.json
52
+ # (https://support.acquia.com/hc/en-us/articles/360048081273-Using-Composer-to-manage-dependencies-in-Drupal-8-and-9),
53
+ # but you may only have composer.lock, so we test if the type is "drupal-*" (e.g. "drupal-module" or "drupal-theme")
54
+ # The Drupal team also setup its own mapper of Composer semver -> Drupal tool-specfic versions
55
+ # (https://www.drupal.org/project/project_composer/issues/2622450),
56
+ # so we return the Drupal requirement instead of semver requirement if it's here
57
+ # (https://www.drupal.org/docs/develop/using-composer/using-composer-to-install-drupal-and-manage-dependencies#s-about-semantic-versioning)
58
+ private_class_method def self.is_drupal_module(dependency)
59
+ dependency["type"] =~ /drupal/ && dependency.dig("source", "reference")
60
+ end
43
61
  end
44
62
  end
45
63
  end
@@ -1,3 +1,3 @@
1
1
  module Bibliothecary
2
- VERSION = "7.0.0"
2
+ VERSION = "7.1.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: 7.0.0
4
+ version: 7.1.1
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-06-17 00:00:00.000000000 Z
11
+ date: 2021-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tomlrb
@@ -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:
@@ -274,7 +274,7 @@ homepage: https://github.com/librariesio/bibliothecary
274
274
  licenses:
275
275
  - AGPL-3.0
276
276
  metadata: {}
277
- post_install_message:
277
+ post_install_message:
278
278
  rdoc_options: []
279
279
  require_paths:
280
280
  - lib
@@ -289,8 +289,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
289
289
  - !ruby/object:Gem::Version
290
290
  version: '0'
291
291
  requirements: []
292
- rubygems_version: 3.2.15
293
- signing_key:
292
+ rubygems_version: 3.1.2
293
+ signing_key:
294
294
  specification_version: 4
295
295
  summary: Find and parse manifests
296
296
  test_files: []