bibliothecary 6.3.2 → 6.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bibliothecary/analyser.rb +39 -11
- data/lib/bibliothecary/parsers/bower.rb +1 -1
- data/lib/bibliothecary/parsers/cargo.rb +2 -2
- data/lib/bibliothecary/parsers/carthage.rb +3 -3
- data/lib/bibliothecary/parsers/clojars.rb +1 -1
- data/lib/bibliothecary/parsers/cocoapods.rb +4 -4
- data/lib/bibliothecary/parsers/cpan.rb +2 -2
- data/lib/bibliothecary/parsers/cran.rb +1 -1
- data/lib/bibliothecary/parsers/dub.rb +2 -2
- data/lib/bibliothecary/parsers/elm.rb +2 -2
- data/lib/bibliothecary/parsers/go.rb +8 -8
- data/lib/bibliothecary/parsers/hackage.rb +2 -2
- data/lib/bibliothecary/parsers/haxelib.rb +1 -1
- data/lib/bibliothecary/parsers/hex.rb +2 -2
- data/lib/bibliothecary/parsers/julia.rb +1 -1
- data/lib/bibliothecary/parsers/maven.rb +5 -5
- data/lib/bibliothecary/parsers/meteor.rb +1 -1
- data/lib/bibliothecary/parsers/npm.rb +4 -4
- data/lib/bibliothecary/parsers/nuget.rb +6 -6
- data/lib/bibliothecary/parsers/packagist.rb +2 -2
- data/lib/bibliothecary/parsers/pub.rb +2 -2
- data/lib/bibliothecary/parsers/pypi.rb +5 -4
- data/lib/bibliothecary/parsers/rubygems.rb +3 -3
- data/lib/bibliothecary/parsers/shard.rb +2 -2
- data/lib/bibliothecary/parsers/swift_pm.rb +1 -1
- data/lib/bibliothecary/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35f76a25c41ad5a990e6c6232536f768015703be873a63c852d70369e3ae9295
|
4
|
+
data.tar.gz: 7faa006c8ff306dc560d57324cf9ad8d5798030aab058bb7d513b3a834c9ecc4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecc552df23a5489aa6b430e2626f48b8600032a74a1a8c8f522c3ef9d9b9e39a7e1646d61651374bd50dc26f75ec5c905e638c29c9c7a7ab9670b5adc8792d57
|
7
|
+
data.tar.gz: 1a1e7a14eb4e1a75899d3ac319d98367eb9b883d23ea63f312a2405e1076a7d5702fbb35b0755ae864eea2a065fede8ed74749a5a31d7bff31effa835aff60ad
|
@@ -25,8 +25,8 @@ module Bibliothecary
|
|
25
25
|
base.extend(ClassMethods)
|
26
26
|
end
|
27
27
|
module ClassMethods
|
28
|
-
def mapping_entry_match?(
|
29
|
-
if info.relative_path
|
28
|
+
def mapping_entry_match?(matcher, details, info)
|
29
|
+
if matcher.call(info.relative_path)
|
30
30
|
# we only want to load contents if we don't have them already
|
31
31
|
# and there's a content_matcher method to use
|
32
32
|
return true if details[:content_matcher].nil?
|
@@ -41,8 +41,8 @@ module Bibliothecary
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def parse_file(filename, contents)
|
44
|
-
mapping.each do |
|
45
|
-
if mapping_entry_match?(
|
44
|
+
mapping.each do |matcher, details|
|
45
|
+
if mapping_entry_match?(matcher, details, FileInfo.new(nil, filename, contents))
|
46
46
|
begin
|
47
47
|
# The `parser` method should raise an exception if the file is malformed,
|
48
48
|
# should return empty [] if the file is fine but simply doesn't contain
|
@@ -73,8 +73,8 @@ module Bibliothecary
|
|
73
73
|
end
|
74
74
|
|
75
75
|
def match_info?(info)
|
76
|
-
mapping.any? do |
|
77
|
-
mapping_entry_match?(
|
76
|
+
mapping.any? do |matcher, details|
|
77
|
+
mapping_entry_match?(matcher, details, info)
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
@@ -182,8 +182,8 @@ module Bibliothecary
|
|
182
182
|
end
|
183
183
|
|
184
184
|
def determine_kind_from_info(info)
|
185
|
-
mapping.each do |
|
186
|
-
if mapping_entry_match?(
|
185
|
+
mapping.each do |matcher, details|
|
186
|
+
if mapping_entry_match?(matcher, details, info)
|
187
187
|
return details[:kind]
|
188
188
|
end
|
189
189
|
end
|
@@ -197,8 +197,8 @@ module Bibliothecary
|
|
197
197
|
end
|
198
198
|
|
199
199
|
def determine_can_have_lockfile_from_info(info)
|
200
|
-
mapping.each do |
|
201
|
-
if mapping_entry_match?(
|
200
|
+
mapping.each do |matcher, details|
|
201
|
+
if mapping_entry_match?(matcher, details, info)
|
202
202
|
return details.fetch(:can_have_lockfile, true)
|
203
203
|
end
|
204
204
|
end
|
@@ -209,11 +209,39 @@ module Bibliothecary
|
|
209
209
|
manifest.dependencies.inject([]) do |deps, dep|
|
210
210
|
deps.push({
|
211
211
|
name: dep.name,
|
212
|
-
requirement: dep
|
212
|
+
requirement: dep
|
213
|
+
.requirement
|
214
|
+
.requirements
|
215
|
+
.sort_by(&:last)
|
216
|
+
.map { |op, version| "#{op} #{version}" }
|
217
|
+
.join(", "),
|
213
218
|
type: dep.type
|
214
219
|
})
|
215
220
|
end.uniq
|
216
221
|
end
|
222
|
+
|
223
|
+
def match_filename(filename, case_insensitive: false)
|
224
|
+
if case_insensitive
|
225
|
+
lambda { |path| path.downcase == filename.downcase || path.downcase.end_with?("/" + filename.downcase) }
|
226
|
+
else
|
227
|
+
lambda { |path| path == filename || path.end_with?("/" + filename) }
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
def match_filenames(*filenames)
|
232
|
+
lambda do |path|
|
233
|
+
filenames.any? { |f| path == f } ||
|
234
|
+
filenames.any? { |f| path.end_with?("/" + f) }
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
def match_extension(filename, case_insensitive: false)
|
239
|
+
if case_insensitive
|
240
|
+
lambda { |path| path.downcase.end_with?(filename.downcase) }
|
241
|
+
else
|
242
|
+
lambda { |path| path.end_with?(filename) }
|
243
|
+
end
|
244
|
+
end
|
217
245
|
end
|
218
246
|
end
|
219
247
|
end
|
@@ -7,11 +7,11 @@ module Bibliothecary
|
|
7
7
|
|
8
8
|
def self.mapping
|
9
9
|
{
|
10
|
-
|
10
|
+
match_filename("Cargo.toml") => {
|
11
11
|
kind: 'manifest',
|
12
12
|
parser: :parse_manifest
|
13
13
|
},
|
14
|
-
|
14
|
+
match_filename("Cargo.lock") => {
|
15
15
|
kind: 'lockfile',
|
16
16
|
parser: :parse_lockfile
|
17
17
|
}
|
@@ -5,15 +5,15 @@ module Bibliothecary
|
|
5
5
|
|
6
6
|
def self.mapping
|
7
7
|
{
|
8
|
-
|
8
|
+
match_filename("Cartfile") => {
|
9
9
|
kind: 'manifest',
|
10
10
|
parser: :parse_cartfile
|
11
11
|
},
|
12
|
-
|
12
|
+
match_filename("Cartfile.private") => {
|
13
13
|
kind: 'manifest',
|
14
14
|
parser: :parse_cartfile_private
|
15
15
|
},
|
16
|
-
|
16
|
+
match_filename("Cartfile.resolved") => {
|
17
17
|
kind: 'lockfile',
|
18
18
|
parser: :parse_cartfile_resolved
|
19
19
|
}
|
@@ -11,20 +11,20 @@ module Bibliothecary
|
|
11
11
|
|
12
12
|
def self.mapping
|
13
13
|
{
|
14
|
-
|
14
|
+
match_filename("Podfile") => {
|
15
15
|
kind: 'manifest',
|
16
16
|
parser: :parse_podfile
|
17
17
|
},
|
18
|
-
|
18
|
+
match_extension(".podspec") => {
|
19
19
|
kind: 'manifest',
|
20
20
|
parser: :parse_podspec,
|
21
21
|
can_have_lockfile: false
|
22
22
|
},
|
23
|
-
|
23
|
+
match_filename("Podfile.lock") => {
|
24
24
|
kind: 'lockfile',
|
25
25
|
parser: :parse_podfile_lock
|
26
26
|
},
|
27
|
-
|
27
|
+
match_extension(".podspec.json") => {
|
28
28
|
kind: 'manifest',
|
29
29
|
parser: :parse_json_manifest,
|
30
30
|
can_have_lockfile: false
|
@@ -8,11 +8,11 @@ module Bibliothecary
|
|
8
8
|
|
9
9
|
def self.mapping
|
10
10
|
{
|
11
|
-
|
11
|
+
match_filename("META.json", case_insensitive: true) => {
|
12
12
|
kind: 'manifest',
|
13
13
|
parser: :parse_json_manifest
|
14
14
|
},
|
15
|
-
|
15
|
+
match_filename("META.yml", case_insensitive: true) => {
|
16
16
|
kind: 'manifest',
|
17
17
|
parser: :parse_yaml_manifest
|
18
18
|
}
|
@@ -8,11 +8,11 @@ module Bibliothecary
|
|
8
8
|
|
9
9
|
def self.mapping
|
10
10
|
{
|
11
|
-
|
11
|
+
match_filename("dub.json") => {
|
12
12
|
kind: 'manifest',
|
13
13
|
parser: :parse_json_runtime_manifest
|
14
14
|
},
|
15
|
-
|
15
|
+
match_filename("dub.sdl") => {
|
16
16
|
kind: 'manifest',
|
17
17
|
parser: :parse_sdl_manifest
|
18
18
|
}
|
@@ -7,11 +7,11 @@ module Bibliothecary
|
|
7
7
|
|
8
8
|
def self.mapping
|
9
9
|
{
|
10
|
-
|
10
|
+
match_filenames("elm-package.json", "elm_dependencies.json") => {
|
11
11
|
kind: 'manifest',
|
12
12
|
parser: :parse_json_runtime_manifest
|
13
13
|
},
|
14
|
-
|
14
|
+
match_filename("elm-stuff/exact-dependencies.json") => {
|
15
15
|
kind: 'lockfile',
|
16
16
|
parser: :parse_json_lock
|
17
17
|
}
|
@@ -10,35 +10,35 @@ module Bibliothecary
|
|
10
10
|
|
11
11
|
def self.mapping
|
12
12
|
{
|
13
|
-
|
13
|
+
match_filename("glide.yaml") => {
|
14
14
|
kind: 'manifest',
|
15
15
|
parser: :parse_glide_yaml
|
16
16
|
},
|
17
|
-
|
17
|
+
match_filename("glide.lock") => {
|
18
18
|
kind: 'lockfile',
|
19
19
|
parser: :parse_glide_lockfile
|
20
20
|
},
|
21
|
-
|
21
|
+
match_filename("Godeps/Godeps.json") => {
|
22
22
|
kind: 'manifest',
|
23
23
|
parser: :parse_godep_json
|
24
24
|
},
|
25
|
-
|
25
|
+
match_filename("Godeps", case_insensitive: true) => {
|
26
26
|
kind: 'manifest',
|
27
27
|
parser: :parse_gpm
|
28
28
|
},
|
29
|
-
|
29
|
+
match_filename("vendor/manifest") => {
|
30
30
|
kind: 'manifest',
|
31
31
|
parser: :parse_gb_manifest
|
32
32
|
},
|
33
|
-
|
33
|
+
match_filename("vendor/vendor.json") => {
|
34
34
|
kind: 'manifest',
|
35
35
|
parser: :parse_govendor
|
36
36
|
},
|
37
|
-
|
37
|
+
match_filename("Gopkg.toml") => {
|
38
38
|
kind: 'manifest',
|
39
39
|
parser: :parse_dep_toml
|
40
40
|
},
|
41
|
-
|
41
|
+
match_filename("Gopkg.lock") => {
|
42
42
|
kind: 'lockfile',
|
43
43
|
parser: :parse_dep_lockfile
|
44
44
|
},
|
@@ -8,11 +8,11 @@ module Bibliothecary
|
|
8
8
|
|
9
9
|
def self.mapping
|
10
10
|
{
|
11
|
-
|
11
|
+
match_extension(".cabal") => {
|
12
12
|
kind: 'manifest',
|
13
13
|
parser: :parse_cabal
|
14
14
|
},
|
15
|
-
|
15
|
+
match_extension("cabal.config") => {
|
16
16
|
kind: 'lockfile',
|
17
17
|
parser: :parse_cabal_config
|
18
18
|
},
|
@@ -7,11 +7,11 @@ module Bibliothecary
|
|
7
7
|
|
8
8
|
def self.mapping
|
9
9
|
{
|
10
|
-
|
10
|
+
match_filename("mix.exs") => {
|
11
11
|
kind: 'manifest',
|
12
12
|
parser: :parse_mix
|
13
13
|
},
|
14
|
-
|
14
|
+
match_filename("mix.lock") => {
|
15
15
|
kind: 'lockfile',
|
16
16
|
parser: :parse_mix_lock
|
17
17
|
}
|
@@ -13,24 +13,24 @@ module Bibliothecary
|
|
13
13
|
|
14
14
|
def self.mapping
|
15
15
|
{
|
16
|
-
|
16
|
+
match_filename("ivy.xml", case_insensitive: true) => {
|
17
17
|
kind: 'manifest',
|
18
18
|
parser: :parse_ivy_manifest
|
19
19
|
},
|
20
|
-
|
20
|
+
match_filename("pom.xml", case_insensitive: true) => {
|
21
21
|
kind: 'manifest',
|
22
22
|
parser: :parse_pom_manifest
|
23
23
|
},
|
24
|
-
|
24
|
+
match_filename("build.gradle", case_insensitive: true) => {
|
25
25
|
kind: 'manifest',
|
26
26
|
parser: :parse_gradle
|
27
27
|
},
|
28
|
-
|
28
|
+
match_extension(".xml", case_insensitive: true) => {
|
29
29
|
content_matcher: :ivy_report?,
|
30
30
|
kind: 'lockfile',
|
31
31
|
parser: :parse_ivy_report
|
32
32
|
},
|
33
|
-
|
33
|
+
match_filename("gradle-dependencies-q.txt", case_insensitive: true) => {
|
34
34
|
kind: 'lockfile',
|
35
35
|
parser: :parse_gradle_resolved
|
36
36
|
}
|
@@ -7,19 +7,19 @@ module Bibliothecary
|
|
7
7
|
|
8
8
|
def self.mapping
|
9
9
|
{
|
10
|
-
|
10
|
+
match_filename("package.json") => {
|
11
11
|
kind: 'manifest',
|
12
12
|
parser: :parse_manifest
|
13
13
|
},
|
14
|
-
|
14
|
+
match_filename("npm-shrinkwrap.json") => {
|
15
15
|
kind: 'lockfile',
|
16
16
|
parser: :parse_shrinkwrap
|
17
17
|
},
|
18
|
-
|
18
|
+
match_filename("yarn.lock") => {
|
19
19
|
kind: 'lockfile',
|
20
20
|
parser: :parse_yarn_lock
|
21
21
|
},
|
22
|
-
|
22
|
+
match_filename("package-lock.json") => {
|
23
23
|
kind: 'lockfile',
|
24
24
|
parser: :parse_package_lock
|
25
25
|
}
|
@@ -8,27 +8,27 @@ module Bibliothecary
|
|
8
8
|
|
9
9
|
def self.mapping
|
10
10
|
{
|
11
|
-
|
11
|
+
match_filename("Project.json") => {
|
12
12
|
kind: 'manifest',
|
13
13
|
parser: :parse_json_runtime_manifest
|
14
14
|
},
|
15
|
-
|
15
|
+
match_filename("Project.lock.json") => {
|
16
16
|
kind: 'lockfile',
|
17
17
|
parser: :parse_project_lock_json
|
18
18
|
},
|
19
|
-
|
19
|
+
match_filename("packages.config") => {
|
20
20
|
kind: 'manifest',
|
21
21
|
parser: :parse_packages_config
|
22
22
|
},
|
23
|
-
|
23
|
+
match_extension(".nuspec") => {
|
24
24
|
kind: 'manifest',
|
25
25
|
parser: :parse_nuspec
|
26
26
|
},
|
27
|
-
|
27
|
+
match_extension(".csproj") => {
|
28
28
|
kind: 'manifest',
|
29
29
|
parser: :parse_csproj
|
30
30
|
},
|
31
|
-
|
31
|
+
match_filename("paket.lock") => {
|
32
32
|
kind: 'lockfile',
|
33
33
|
parser: :parse_paket_lock
|
34
34
|
}
|
@@ -7,11 +7,11 @@ module Bibliothecary
|
|
7
7
|
|
8
8
|
def self.mapping
|
9
9
|
{
|
10
|
-
|
10
|
+
match_filename("composer.json") => {
|
11
11
|
kind: 'manifest',
|
12
12
|
parser: :parse_manifest
|
13
13
|
},
|
14
|
-
|
14
|
+
match_filename("composer.lock") => {
|
15
15
|
kind: 'lockfile',
|
16
16
|
parser: :parse_lockfile
|
17
17
|
}
|
@@ -7,11 +7,11 @@ module Bibliothecary
|
|
7
7
|
|
8
8
|
def self.mapping
|
9
9
|
{
|
10
|
-
|
10
|
+
match_filename("pubspec.yaml", case_insensitive: true) => {
|
11
11
|
kind: 'manifest',
|
12
12
|
parser: :parse_yaml_manifest
|
13
13
|
},
|
14
|
-
|
14
|
+
match_filename("pubspec.lock", case_insensitive: true) => {
|
15
15
|
kind: 'lockfile',
|
16
16
|
parser: :parse_yaml_lockfile
|
17
17
|
}
|
@@ -6,24 +6,25 @@ 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
10
|
|
10
11
|
def self.mapping
|
11
12
|
{
|
12
|
-
|
13
|
+
lambda { |p| MANIFEST_REGEXP.match(p) } => {
|
13
14
|
kind: 'manifest',
|
14
15
|
parser: :parse_requirements_txt,
|
15
16
|
can_have_lockfile: false
|
16
17
|
},
|
17
|
-
|
18
|
+
match_filename("setup.py") => {
|
18
19
|
kind: 'manifest',
|
19
20
|
parser: :parse_setup_py,
|
20
21
|
can_have_lockfile: false
|
21
22
|
},
|
22
|
-
|
23
|
+
match_filename("Pipfile") => {
|
23
24
|
kind: 'manifest',
|
24
25
|
parser: :parse_pipfile
|
25
26
|
},
|
26
|
-
|
27
|
+
match_filename("Pipfile.lock") => {
|
27
28
|
kind: 'lockfile',
|
28
29
|
parser: :parse_pipfile_lock
|
29
30
|
}
|
@@ -10,16 +10,16 @@ module Bibliothecary
|
|
10
10
|
|
11
11
|
def self.mapping
|
12
12
|
{
|
13
|
-
|
13
|
+
match_filenames("Gemfile", "gems.rb") => {
|
14
14
|
kind: 'manifest',
|
15
15
|
parser: :parse_gemfile
|
16
16
|
},
|
17
|
-
|
17
|
+
match_extension(".gemspec") => {
|
18
18
|
kind: 'manifest',
|
19
19
|
parser: :parse_gemspec,
|
20
20
|
can_have_lockfile: false
|
21
21
|
},
|
22
|
-
|
22
|
+
match_filenames("Gemfile.lock", "gems.locked") => {
|
23
23
|
kind: 'lockfile',
|
24
24
|
parser: :parse_gemfile_lock
|
25
25
|
}
|
@@ -7,11 +7,11 @@ module Bibliothecary
|
|
7
7
|
|
8
8
|
def self.mapping
|
9
9
|
{
|
10
|
-
|
10
|
+
match_filename("shard.yml", case_insensitive: true) => {
|
11
11
|
kind: 'manifest',
|
12
12
|
parser: :parse_yaml_manifest
|
13
13
|
},
|
14
|
-
|
14
|
+
match_filename("shard.lock", case_insensitive: true) => {
|
15
15
|
kind: 'lockfile',
|
16
16
|
parser: :parse_yaml_lockfile
|
17
17
|
}
|
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.
|
4
|
+
version: 6.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Nesbitt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-03
|
11
|
+
date: 2019-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: toml-rb
|