bibliothecary 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/bibliothecary/parsers/cargo.rb +21 -17
- data/lib/bibliothecary/parsers/cocoapods.rb +21 -17
- data/lib/bibliothecary/parsers/maven.rb +36 -29
- data/lib/bibliothecary/parsers/nuget.rb +52 -42
- data/lib/bibliothecary/parsers/pypi.rb +21 -17
- data/lib/bibliothecary/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2cb2459a1a23ab026d88c3914037be5605a6105e
|
|
4
|
+
data.tar.gz: c608876219f4fc438b8cfc9e2ab5e90558f2e0da
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 09236de8f35df1cce5a4f137d282ce5b4b3cbfb57808760600752ea79d9e65fd49bdd3645c2463ee1e03d2cf3aa2004649bde7e0a14fdd2a83f5d03b3aaab6e7
|
|
7
|
+
data.tar.gz: 88a52f790799d60c37b0406bb8079ae3d8749938596fd395c432eae0e8026a23027d43238dd1f757bd05700048a48270bda1abede280e74ed6f6fa99243bf492
|
|
@@ -18,20 +18,22 @@ module Bibliothecary
|
|
|
18
18
|
|
|
19
19
|
def self.analyse(folder_path, file_list)
|
|
20
20
|
[analyse_cargo_toml(folder_path, file_list),
|
|
21
|
-
analyse_cargo_lock(folder_path, file_list)]
|
|
21
|
+
analyse_cargo_lock(folder_path, file_list)].flatten
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
def self.analyse_cargo_toml(folder_path, file_list)
|
|
25
|
-
|
|
26
|
-
return unless
|
|
25
|
+
paths = file_list.select{|path| path.gsub(folder_path, '').gsub(/^\//, '').match(/Cargo\.toml$/) }
|
|
26
|
+
return unless paths.any?
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
paths.map do |path|
|
|
29
|
+
manifest = TOML.load_file(path)
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
{
|
|
32
|
+
platform: PLATFORM_NAME,
|
|
33
|
+
path: path,
|
|
34
|
+
dependencies: parse_manifest(manifest)
|
|
35
|
+
}
|
|
36
|
+
end
|
|
35
37
|
end
|
|
36
38
|
|
|
37
39
|
def self.parse_manifest(manifest)
|
|
@@ -45,16 +47,18 @@ module Bibliothecary
|
|
|
45
47
|
end
|
|
46
48
|
|
|
47
49
|
def self.analyse_cargo_lock(folder_path, file_list)
|
|
48
|
-
|
|
49
|
-
return unless
|
|
50
|
+
paths = file_list.select{|path| path.gsub(folder_path, '').gsub(/^\//, '').match(/Cargo\.lock$/) }
|
|
51
|
+
return unless paths.any?
|
|
50
52
|
|
|
51
|
-
|
|
53
|
+
paths.map do |path|
|
|
54
|
+
manifest = TOML.load_file(path)
|
|
52
55
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
{
|
|
57
|
+
platform: PLATFORM_NAME,
|
|
58
|
+
path: path,
|
|
59
|
+
dependencies: parse_lockfile(manifest)
|
|
60
|
+
}
|
|
61
|
+
end
|
|
58
62
|
end
|
|
59
63
|
|
|
60
64
|
def self.parse_lockfile(manifest)
|
|
@@ -34,7 +34,7 @@ module Bibliothecary
|
|
|
34
34
|
analyse_podspec(folder_path, file_list),
|
|
35
35
|
analyse_podfile_lock(folder_path, file_list),
|
|
36
36
|
analyse_podspec_json(folder_path, file_list)
|
|
37
|
-
]
|
|
37
|
+
].flatten
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
def self.analyse_podfile(folder_path, file_list)
|
|
@@ -51,29 +51,33 @@ module Bibliothecary
|
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
def self.analyse_podspec(folder_path, file_list)
|
|
54
|
-
|
|
55
|
-
return unless
|
|
54
|
+
paths = file_list.select{|path| path.gsub(folder_path, '').gsub(/^\//, '').match(/^[A-Za-z0-9_-]+\.podspec$/) }
|
|
55
|
+
return unless paths.any?
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
paths.map do |path|
|
|
58
|
+
manifest = Gemnasium::Parser.send(:podspec, File.open(path).read)
|
|
58
59
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
{
|
|
61
|
+
platform: PLATFORM_NAME,
|
|
62
|
+
path: path,
|
|
63
|
+
dependencies: parse_manifest(manifest)
|
|
64
|
+
}
|
|
65
|
+
end
|
|
64
66
|
end
|
|
65
67
|
|
|
66
68
|
def self.analyse_podspec_json(folder_path, file_list)
|
|
67
|
-
|
|
68
|
-
return unless
|
|
69
|
+
paths = file_list.select{|path| path.gsub(folder_path, '').gsub(/^\//, '').match(/^[A-Za-z0-9_-]+\.podspec.json$/) }
|
|
70
|
+
return unless paths.any?
|
|
69
71
|
|
|
70
|
-
|
|
72
|
+
paths.map do |path|
|
|
73
|
+
manifest = JSON.parse File.open(path).read
|
|
71
74
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
{
|
|
76
|
+
platform: PLATFORM_NAME,
|
|
77
|
+
path: path,
|
|
78
|
+
dependencies: parse_json_manifest(manifest)
|
|
79
|
+
}
|
|
80
|
+
end
|
|
77
81
|
end
|
|
78
82
|
|
|
79
83
|
def self.analyse_podfile_lock(folder_path, file_list)
|
|
@@ -6,13 +6,13 @@ module Bibliothecary
|
|
|
6
6
|
PLATFORM_NAME = 'Maven'
|
|
7
7
|
|
|
8
8
|
def self.parse(filename, file_contents)
|
|
9
|
-
if filename.match(
|
|
9
|
+
if filename.match(/ivy\.xml$/i)
|
|
10
10
|
xml = Ox.parse file_contents
|
|
11
11
|
parse_ivy_manifest(xml)
|
|
12
|
-
elsif filename.match(
|
|
12
|
+
elsif filename.match(/pom\.xml$/i)
|
|
13
13
|
xml = Ox.parse file_contents
|
|
14
14
|
parse_pom_manifest(xml)
|
|
15
|
-
elsif filename.match(
|
|
15
|
+
elsif filename.match(/build.gradle$/i)
|
|
16
16
|
parse_gradle(file_contents)
|
|
17
17
|
else
|
|
18
18
|
[]
|
|
@@ -24,45 +24,52 @@ module Bibliothecary
|
|
|
24
24
|
analyse_pom(folder_path, file_list),
|
|
25
25
|
analyse_ivy(folder_path, file_list),
|
|
26
26
|
analyse_gradle(folder_path, file_list),
|
|
27
|
-
]
|
|
27
|
+
].flatten
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
def self.analyse_pom(folder_path, file_list)
|
|
31
|
-
|
|
32
|
-
return unless
|
|
31
|
+
paths = file_list.select{|path| path.gsub(folder_path, '').gsub(/^\//, '').match(/pom\.xml$/i) }
|
|
32
|
+
return unless paths.any?
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
paths.map do |path|
|
|
35
|
+
manifest = Ox.parse File.open(path).read
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
{
|
|
38
|
+
platform: PLATFORM_NAME,
|
|
39
|
+
path: path,
|
|
40
|
+
dependencies: parse_pom_manifest(manifest)
|
|
41
|
+
}
|
|
42
|
+
end
|
|
41
43
|
end
|
|
42
44
|
|
|
43
45
|
def self.analyse_ivy(folder_path, file_list)
|
|
44
|
-
|
|
45
|
-
return unless
|
|
46
|
+
paths = file_list.select{|path| path.gsub(folder_path, '').gsub(/^\//, '').match(/ivy\.xml$/i) }
|
|
47
|
+
return unless paths.any?
|
|
46
48
|
|
|
47
|
-
|
|
49
|
+
paths.map do |path|
|
|
50
|
+
manifest = Ox.parse File.open(path).read
|
|
48
51
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
{
|
|
53
|
+
platform: PLATFORM_NAME,
|
|
54
|
+
path: path,
|
|
55
|
+
dependencies: parse_ivy_manifest(manifest)
|
|
56
|
+
}
|
|
57
|
+
end
|
|
54
58
|
end
|
|
55
59
|
|
|
56
60
|
def self.analyse_gradle(folder_path, file_list)
|
|
57
|
-
|
|
58
|
-
return unless
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
paths = file_list.select{|path| path.gsub(folder_path, '').gsub(/^\//, '').match(/build\.gradle$/i) }
|
|
62
|
+
return unless paths.any?
|
|
63
|
+
|
|
64
|
+
paths.map do |path|
|
|
65
|
+
manifest = File.open(path).read
|
|
66
|
+
|
|
67
|
+
{
|
|
68
|
+
platform: PLATFORM_NAME,
|
|
69
|
+
path: path,
|
|
70
|
+
dependencies: parse_gradle(manifest)
|
|
71
|
+
}
|
|
72
|
+
end
|
|
66
73
|
end
|
|
67
74
|
|
|
68
75
|
def self.parse_ivy_manifest(manifest)
|
|
@@ -31,71 +31,81 @@ module Bibliothecary
|
|
|
31
31
|
analyse_project_lock_json(folder_path, file_list),
|
|
32
32
|
analyse_packages_config(folder_path, file_list),
|
|
33
33
|
analyse_nuspec(folder_path, file_list),
|
|
34
|
-
analyse_paket_lock(folder_path, file_list)]
|
|
34
|
+
analyse_paket_lock(folder_path, file_list)].flatten
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
def self.analyse_project_json(folder_path, file_list)
|
|
38
|
-
|
|
39
|
-
return unless
|
|
38
|
+
paths = file_list.select{|path| path.gsub(folder_path, '').gsub(/^\//, '').match(/Project\.json$/i) }
|
|
39
|
+
return unless paths.any?
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
paths.map do |path|
|
|
42
|
+
manifest = JSON.parse File.open(path).read
|
|
42
43
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
{
|
|
45
|
+
platform: PLATFORM_NAME,
|
|
46
|
+
path: path,
|
|
47
|
+
dependencies: parse_project_json(manifest)
|
|
48
|
+
}
|
|
49
|
+
end
|
|
48
50
|
end
|
|
49
51
|
|
|
50
52
|
def self.analyse_project_lock_json(folder_path, file_list)
|
|
51
|
-
|
|
52
|
-
return unless
|
|
53
|
+
paths = file_list.select{|path| path.gsub(folder_path, '').gsub(/^\//, '').match(/Project\.lock\.json$/) }
|
|
54
|
+
return unless paths.any?
|
|
53
55
|
|
|
54
|
-
|
|
56
|
+
paths.map do |path|
|
|
57
|
+
manifest = JSON.parse File.open(path).read
|
|
55
58
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
{
|
|
60
|
+
platform: PLATFORM_NAME,
|
|
61
|
+
path: path,
|
|
62
|
+
dependencies: parse_project_lock_json(manifest)
|
|
63
|
+
}
|
|
64
|
+
end
|
|
61
65
|
end
|
|
62
66
|
|
|
63
67
|
def self.analyse_packages_config(folder_path, file_list)
|
|
64
|
-
|
|
65
|
-
return unless
|
|
68
|
+
paths = file_list.select{|path| path.gsub(folder_path, '').gsub(/^\//, '').match(/packages\.config$/) }
|
|
69
|
+
return unless paths.any?
|
|
66
70
|
|
|
67
|
-
|
|
71
|
+
paths.map do |path|
|
|
72
|
+
manifest = Ox.parse File.open(path).read
|
|
68
73
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
+
{
|
|
75
|
+
platform: PLATFORM_NAME,
|
|
76
|
+
path: path,
|
|
77
|
+
dependencies: parse_packages_config(manifest)
|
|
78
|
+
}
|
|
79
|
+
end
|
|
74
80
|
end
|
|
75
81
|
|
|
76
82
|
def self.analyse_nuspec(folder_path, file_list)
|
|
77
|
-
|
|
78
|
-
return unless
|
|
83
|
+
paths = file_list.select{|path| path.gsub(folder_path, '').gsub(/^\//, '').match(/^[A-Za-z0-9_-]+\.nuspec$/) }
|
|
84
|
+
return unless paths.any?
|
|
79
85
|
|
|
80
|
-
|
|
86
|
+
paths.map do |path|
|
|
87
|
+
manifest = Ox.parse File.open(path).read
|
|
81
88
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
89
|
+
{
|
|
90
|
+
platform: PLATFORM_NAME,
|
|
91
|
+
path: path,
|
|
92
|
+
dependencies: parse_nuspec(manifest)
|
|
93
|
+
}
|
|
94
|
+
end
|
|
87
95
|
end
|
|
88
96
|
|
|
89
97
|
def self.analyse_paket_lock(folder_path, file_list)
|
|
90
|
-
|
|
91
|
-
return unless
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
98
|
+
paths = file_list.select{|path| path.gsub(folder_path, '').gsub(/^\//, '').match(/paket\.lock$/) }
|
|
99
|
+
return unless paths.any?
|
|
100
|
+
|
|
101
|
+
paths.map do |path|
|
|
102
|
+
lines = File.readlines(path)
|
|
103
|
+
{
|
|
104
|
+
platform: PLATFORM_NAME,
|
|
105
|
+
path: path,
|
|
106
|
+
dependencies: parse_paket_lock(lines)
|
|
107
|
+
}
|
|
108
|
+
end
|
|
99
109
|
end
|
|
100
110
|
|
|
101
111
|
def self.parse_project_json(manifest)
|
|
@@ -19,36 +19,40 @@ module Bibliothecary
|
|
|
19
19
|
|
|
20
20
|
def self.analyse(folder_path, file_list)
|
|
21
21
|
[analyse_requirements_txt(folder_path, file_list),
|
|
22
|
-
analyse_setup_py(folder_path, file_list)]
|
|
22
|
+
analyse_setup_py(folder_path, file_list)].flatten
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
def self.analyse_requirements_txt(folder_path, file_list)
|
|
26
|
-
|
|
26
|
+
paths = file_list.select do |path|
|
|
27
27
|
p = path.gsub(folder_path, '').gsub(/^\//, '')
|
|
28
28
|
p.match(/require.*\.(txt|pip)$/) && !path.match(/^node_modules/)
|
|
29
29
|
end
|
|
30
|
-
return unless
|
|
30
|
+
return unless paths.any?
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
paths.map do |path|
|
|
33
|
+
manifest = File.open(path).read
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
{
|
|
36
|
+
platform: PLATFORM_NAME,
|
|
37
|
+
path: path,
|
|
38
|
+
dependencies: parse_requirements_txt(manifest)
|
|
39
|
+
}
|
|
40
|
+
end
|
|
39
41
|
end
|
|
40
42
|
|
|
41
43
|
def self.analyse_setup_py(folder_path, file_list)
|
|
42
|
-
|
|
43
|
-
return unless
|
|
44
|
+
paths = file_list.select{|path| path.gsub(folder_path, '').gsub(/^\//, '').match(/setup\.py$/) }
|
|
45
|
+
return unless paths.any?
|
|
44
46
|
|
|
45
|
-
|
|
47
|
+
paths.map do |path|
|
|
48
|
+
manifest = File.open(path).read
|
|
46
49
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
{
|
|
51
|
+
platform: PLATFORM_NAME,
|
|
52
|
+
path: path,
|
|
53
|
+
dependencies: parse_setup_py(manifest)
|
|
54
|
+
}
|
|
55
|
+
end
|
|
52
56
|
end
|
|
53
57
|
|
|
54
58
|
def self.parse_setup_py(manifest)
|