bibliothecary 7.0.2 → 7.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bibliothecary/parsers/packagist.rb +22 -4
- data/lib/bibliothecary/parsers/pypi.rb +16 -1
- data/lib/bibliothecary/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 363f07f35de59f9e70b69e78e25c47a16eaaeb88399db593af9fa8907f9057b4
|
4
|
+
data.tar.gz: e960f21a1d5df9dbe686efce3dd0968e08b60f24b20767fc861a344704e9f3f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4758b79d123881d8ead04bc325f2121388e216edffebfceadd2dae1183d8cb04999b205055d29a3b509ffee640e534dce9701a71fb97812d573a3bee0357297
|
7
|
+
data.tar.gz: 753f4495fb06a20dd2e77a41520c9db05b44442f94b261df5c2871454110636ca58efb22ccfecfb1922da8f5510e0edd6e3d5ec9384cf48494325c7489c90757
|
@@ -24,14 +24,20 @@ module Bibliothecary
|
|
24
24
|
{
|
25
25
|
name: dependency["name"],
|
26
26
|
requirement: dependency["version"],
|
27
|
-
type:
|
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:
|
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
|
@@ -6,10 +6,16 @@ module Bibliothecary
|
|
6
6
|
INSTALL_REGEXP = /install_requires\s*=\s*\[([\s\S]*?)\]/
|
7
7
|
REQUIRE_REGEXP = /([a-zA-Z0-9]+[a-zA-Z0-9\-_\.]+)([><=\w\.,]+)?/
|
8
8
|
REQUIREMENTS_REGEXP = /^#{REQUIRE_REGEXP}/
|
9
|
-
MANIFEST_REGEXP = /.*require[^\/]*(\/)?[^\/]*\.(txt|pip)$/
|
9
|
+
MANIFEST_REGEXP = /.*require[^\/]*(\/)?[^\/]*\.(txt|pip|in)$/
|
10
|
+
PIP_COMPILE_REGEXP = /.*require.*$/
|
10
11
|
|
11
12
|
def self.mapping
|
12
13
|
{
|
14
|
+
lambda { |p| PIP_COMPILE_REGEXP.match(p) } => {
|
15
|
+
content_matcher: :pip_compile?,
|
16
|
+
kind: 'lockfile',
|
17
|
+
parser: :parse_requirements_txt
|
18
|
+
},
|
13
19
|
lambda { |p| MANIFEST_REGEXP.match(p) } => {
|
14
20
|
kind: 'manifest',
|
15
21
|
parser: :parse_requirements_txt,
|
@@ -174,6 +180,15 @@ module Bibliothecary
|
|
174
180
|
end
|
175
181
|
deps
|
176
182
|
end
|
183
|
+
|
184
|
+
def self.pip_compile?(file_contents)
|
185
|
+
return file_contents.include?("This file is autogenerated by pip-compile")
|
186
|
+
rescue Exception # rubocop:disable Lint/RescueException
|
187
|
+
# We rescue exception here since native libs can throw a non-StandardError
|
188
|
+
# We don't want to throw errors during the matching phase, only during
|
189
|
+
# parsing after we match.
|
190
|
+
false
|
191
|
+
end
|
177
192
|
end
|
178
193
|
end
|
179
194
|
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.
|
4
|
+
version: 7.1.3
|
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-
|
11
|
+
date: 2021-09-23 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
|
@@ -290,7 +290,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
290
290
|
version: '0'
|
291
291
|
requirements: []
|
292
292
|
rubygems_version: 3.1.2
|
293
|
-
signing_key:
|
293
|
+
signing_key:
|
294
294
|
specification_version: 4
|
295
295
|
summary: Find and parse manifests
|
296
296
|
test_files: []
|