bibliothecary 6.9.1 → 6.9.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/README.md +1 -0
- data/lib/bibliothecary.rb +8 -0
- data/lib/bibliothecary/parsers/go.rb +11 -1
- data/lib/bibliothecary/parsers/maven.rb +9 -4
- data/lib/bibliothecary/parsers/nuget.rb +5 -3
- data/lib/bibliothecary/runner.rb +17 -0
- data/lib/bibliothecary/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d401e2ee48b3c9ea14b1ced4582ca501b5215bfd32283cbfa22ea6a3a013285
|
4
|
+
data.tar.gz: 28872324cf699eea26ac419cec67fba683bc75be6b335943471a82854b762109
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbe0b6dd4065ea9fadf9c2458988fde20d7198d1142dca84460191704e2a7e61e1f9e6d96bd088424fcc5386be6e2b6b9dae479f40bebd03f328d6c623e02140
|
7
|
+
data.tar.gz: 189db2576879293749a94eba6dbcef993e822e0d3fc26ac5e7b8d6de405ac7eb2ae6e513166428197bc6e6f0e718a6bd810d66f24f21cc60bf2ff2f3c25ac82a
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.7.1
|
data/README.md
CHANGED
data/lib/bibliothecary.rb
CHANGED
@@ -29,6 +29,10 @@ module Bibliothecary
|
|
29
29
|
runner.load_file_info_list(path)
|
30
30
|
end
|
31
31
|
|
32
|
+
def self.load_file_info_list_from_paths(paths)
|
33
|
+
runner.load_file_info_list_from_paths(paths)
|
34
|
+
end
|
35
|
+
|
32
36
|
def self.analyse_file(file_path, contents)
|
33
37
|
runner.analyse_file(file_path, contents)
|
34
38
|
end
|
@@ -45,6 +49,10 @@ module Bibliothecary
|
|
45
49
|
runner.find_manifests(path)
|
46
50
|
end
|
47
51
|
|
52
|
+
def self.find_manifests_from_paths(paths)
|
53
|
+
runner.find_manifests_from_paths(paths)
|
54
|
+
end
|
55
|
+
|
48
56
|
def self.ignored_dirs
|
49
57
|
configuration.ignored_dirs
|
50
58
|
end
|
@@ -57,7 +57,11 @@ module Bibliothecary
|
|
57
57
|
match_filename("Gopkg.lock") => {
|
58
58
|
kind: 'lockfile',
|
59
59
|
parser: :parse_dep_lockfile
|
60
|
-
}
|
60
|
+
},
|
61
|
+
match_filename("go-resolved-dependencies.json") => {
|
62
|
+
kind: 'lockfile',
|
63
|
+
parser: :parse_go_resolved
|
64
|
+
},
|
61
65
|
}
|
62
66
|
end
|
63
67
|
|
@@ -140,6 +144,12 @@ module Bibliothecary
|
|
140
144
|
deps.uniq
|
141
145
|
end
|
142
146
|
|
147
|
+
def self.parse_go_resolved(file_contents)
|
148
|
+
JSON.parse(file_contents)
|
149
|
+
.select { |dep| dep["Main"] != "true" }
|
150
|
+
.map { |dep| { name: dep["Path"], requirement: dep["Version"], type: 'runtime' } }
|
151
|
+
end
|
152
|
+
|
143
153
|
def self.map_dependencies(manifest, attr_name, dep_attr_name, version_attr_name, type)
|
144
154
|
manifest.fetch(attr_name,[]).map do |dependency|
|
145
155
|
{
|
@@ -124,12 +124,17 @@ module Bibliothecary
|
|
124
124
|
split = gradle_dep_match.captures[0]
|
125
125
|
|
126
126
|
# org.springframework.boot:spring-boot-starter-web:2.1.0.M3 (*)
|
127
|
-
# Lines can end with (
|
128
|
-
|
127
|
+
# Lines can end with (c), (n), or (*)
|
128
|
+
# to indicate that something was a dependency constraint (c), not resolved (n), or resolved previously (*).
|
129
|
+
dep = line.split(split)[1].sub(/(\((c|n|\*)\))$/, "").sub(" -> ", ":").strip.split(":")
|
130
|
+
|
131
|
+
# A testImplementation line can look like this so just skip those
|
132
|
+
# \--- org.springframework.security:spring-security-test (n)
|
133
|
+
next unless dep.length >= 3
|
134
|
+
|
129
135
|
version = dep[-1]
|
130
|
-
version = version.split("->")[-1].strip if line.include?("->")
|
131
136
|
{
|
132
|
-
name: dep[0
|
137
|
+
name: dep[0..1].join(":"),
|
133
138
|
requirement: version,
|
134
139
|
type: type
|
135
140
|
}
|
@@ -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
|
-
|
74
|
-
|
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)
|
data/lib/bibliothecary/runner.rb
CHANGED
@@ -46,6 +46,19 @@ module Bibliothecary
|
|
46
46
|
Bibliothecary::Parsers.constants.map{|c| Bibliothecary::Parsers.const_get(c) }.sort_by{|c| c.to_s.downcase }
|
47
47
|
end
|
48
48
|
|
49
|
+
def load_file_info_list_from_paths(paths)
|
50
|
+
file_list = []
|
51
|
+
paths.each do |path|
|
52
|
+
info = FileInfo.new(nil, path)
|
53
|
+
|
54
|
+
next if ignored_files.include?(info.relative_path)
|
55
|
+
|
56
|
+
init_package_manager(info)
|
57
|
+
file_list.push(info)
|
58
|
+
end
|
59
|
+
file_list
|
60
|
+
end
|
61
|
+
|
49
62
|
def load_file_info_list(path)
|
50
63
|
file_list = []
|
51
64
|
Find.find(path) do |subpath|
|
@@ -65,6 +78,10 @@ module Bibliothecary
|
|
65
78
|
RelatedFilesInfo.create_from_file_infos(load_file_info_list(path).reject { |info| info.package_manager.nil? })
|
66
79
|
end
|
67
80
|
|
81
|
+
def find_manifests_from_paths(paths)
|
82
|
+
RelatedFilesInfo.create_from_file_infos(load_file_info_list_from_paths(paths).reject { |info| info.package_manager.nil? })
|
83
|
+
end
|
84
|
+
|
68
85
|
def analyse_file(file_path, contents)
|
69
86
|
package_managers.select { |pm| pm.match?(file_path, contents) }.map do |pm|
|
70
87
|
pm.analyse_contents(file_path, contents)
|
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
|
+
version: 6.9.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Nesbitt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-22 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.
|
291
|
+
rubygems_version: 3.1.2
|
292
292
|
signing_key:
|
293
293
|
specification_version: 4
|
294
294
|
summary: Find and parse manifests
|