bibliothecary 6.10.7 → 6.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +28 -0
- data/lib/bibliothecary.rb +2 -2
- data/lib/bibliothecary/parsers/conda.rb +3 -4
- data/lib/bibliothecary/parsers/pypi.rb +29 -1
- data/lib/bibliothecary/runner.rb +19 -12
- data/lib/bibliothecary/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: caaa965267d6272e22ec385e0ad56505f645cdc3437163ec2a9d40471c1e620b
|
4
|
+
data.tar.gz: a2ad1df3e6481e0faed3d27039557b5b248f73fe5fa9864cd7d9462e215af72a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a333bfa32d1c31abf164afd8a09b7060ffe2809b43199273e706e83dd01d9638e57f85787390deba7e923a9b26494e47074718df319bac159d9cfbb4bb32a26
|
7
|
+
data.tar.gz: 7a68137ae7f02721a2ae8ae94dad59783a07ba291c440cbc6469af0164b0f57a83b055dd16ac5ca58ba2a00de76e217a8fd778b30c98b1585760aa47f60c3ff1
|
@@ -0,0 +1,28 @@
|
|
1
|
+
version: 2.1
|
2
|
+
orbs:
|
3
|
+
ruby: circleci/ruby@0.1.2
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
test:
|
7
|
+
docker:
|
8
|
+
- image: circleci/ruby:2.6.6-stretch-node
|
9
|
+
executor: ruby/default
|
10
|
+
steps:
|
11
|
+
- checkout
|
12
|
+
- run:
|
13
|
+
name: Which bundler?
|
14
|
+
command: bundle -v
|
15
|
+
- ruby/bundle-install
|
16
|
+
- run:
|
17
|
+
name: Run specs
|
18
|
+
command: bundle exec rake spec
|
19
|
+
- run:
|
20
|
+
name: CodeClimate
|
21
|
+
command: bundle exec codeclimate-test-reporter
|
22
|
+
|
23
|
+
workflows:
|
24
|
+
version: 2.1
|
25
|
+
test:
|
26
|
+
jobs:
|
27
|
+
- test
|
28
|
+
|
data/lib/bibliothecary.rb
CHANGED
@@ -21,8 +21,8 @@ module Bibliothecary
|
|
21
21
|
runner.load_file_list(path)
|
22
22
|
end
|
23
23
|
|
24
|
-
def self.
|
25
|
-
runner.
|
24
|
+
def self.applicable_package_managers(info)
|
25
|
+
runner.applicable_package_managers(info)
|
26
26
|
end
|
27
27
|
|
28
28
|
def self.load_file_info_list(path)
|
@@ -26,14 +26,13 @@ module Bibliothecary
|
|
26
26
|
}
|
27
27
|
end
|
28
28
|
|
29
|
-
def self.parse_conda(info)
|
30
|
-
dependencies = call_conda_parser_web(info,
|
29
|
+
def self.parse_conda(info, kind = "manifest")
|
30
|
+
dependencies = call_conda_parser_web(info, kind)[kind.to_sym]
|
31
31
|
dependencies.map { |dep| dep.merge(type: "runtime") }
|
32
32
|
end
|
33
33
|
|
34
34
|
def self.parse_conda_lockfile(info)
|
35
|
-
|
36
|
-
dependencies.map { |dep| dep.merge(type: "runtime") }
|
35
|
+
parse_conda(info, "lockfile")
|
37
36
|
end
|
38
37
|
|
39
38
|
private_class_method def self.call_conda_parser_web(file_contents, kind)
|
@@ -39,7 +39,24 @@ module Bibliothecary
|
|
39
39
|
match_filename("poetry.lock") => {
|
40
40
|
kind: 'lockfile',
|
41
41
|
parser: :parse_poetry_lock
|
42
|
-
}
|
42
|
+
},
|
43
|
+
# Pip dependencies can be embedded in conda environment files
|
44
|
+
match_filename("environment.yml") => {
|
45
|
+
parser: :parse_conda,
|
46
|
+
kind: "manifest",
|
47
|
+
},
|
48
|
+
match_filename("environment.yaml") => {
|
49
|
+
parser: :parse_conda,
|
50
|
+
kind: "manifest",
|
51
|
+
},
|
52
|
+
match_filename("environment.yml.lock") => {
|
53
|
+
parser: :parse_conda,
|
54
|
+
kind: "lockfile",
|
55
|
+
},
|
56
|
+
match_filename("environment.yaml.lock") => {
|
57
|
+
parser: :parse_conda,
|
58
|
+
kind: "lockfile",
|
59
|
+
},
|
43
60
|
}
|
44
61
|
end
|
45
62
|
|
@@ -53,6 +70,17 @@ module Bibliothecary
|
|
53
70
|
map_dependencies(manifest['dependencies'], 'runtime') + map_dependencies(manifest['dev-dependencies'], 'develop')
|
54
71
|
end
|
55
72
|
|
73
|
+
def self.parse_conda(file_contents)
|
74
|
+
contents = YAML.safe_load(file_contents)
|
75
|
+
return [] unless contents
|
76
|
+
|
77
|
+
dependencies = contents["dependencies"]
|
78
|
+
pip = dependencies.find { |dep| dep.is_a?(Hash) && dep["pip"]}
|
79
|
+
return [] unless pip
|
80
|
+
|
81
|
+
Pypi.parse_requirements_txt(pip["pip"].join("\n"))
|
82
|
+
end
|
83
|
+
|
56
84
|
def self.map_dependencies(packages, type)
|
57
85
|
return [] unless packages
|
58
86
|
packages.map do |name, info|
|
data/lib/bibliothecary/runner.rb
CHANGED
@@ -32,14 +32,9 @@ module Bibliothecary
|
|
32
32
|
load_file_info_list(path).map { |info| info.full_path }
|
33
33
|
end
|
34
34
|
|
35
|
-
def
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
info.package_manager = matches[0] if matches.length == 1
|
40
|
-
|
41
|
-
# this is a bug at the moment if it's raised (we don't handle it sensibly)
|
42
|
-
raise "Multiple package managers fighting over #{info.relative_path}: #{matches.map(&:to_s)}" if matches.length > 1
|
35
|
+
def applicable_package_managers(info)
|
36
|
+
managers = package_managers.select { |pm| pm.match_info?(info) }
|
37
|
+
managers.length > 0 ? managers : [nil]
|
43
38
|
end
|
44
39
|
|
45
40
|
def package_managers
|
@@ -48,29 +43,41 @@ module Bibliothecary
|
|
48
43
|
|
49
44
|
def load_file_info_list_from_paths(paths)
|
50
45
|
file_list = []
|
46
|
+
|
51
47
|
paths.each do |path|
|
52
48
|
info = FileInfo.new(nil, path)
|
53
49
|
|
54
50
|
next if ignored_files.include?(info.relative_path)
|
55
51
|
|
56
|
-
|
57
|
-
|
52
|
+
applicable_package_managers(info).each do |package_manager|
|
53
|
+
file = info.dup
|
54
|
+
file.package_manager = package_manager
|
55
|
+
|
56
|
+
file_list.push(file)
|
57
|
+
end
|
58
58
|
end
|
59
|
+
|
59
60
|
file_list
|
60
61
|
end
|
61
62
|
|
62
63
|
def load_file_info_list(path)
|
63
64
|
file_list = []
|
65
|
+
|
64
66
|
Find.find(path) do |subpath|
|
65
67
|
info = FileInfo.new(path, subpath)
|
68
|
+
|
66
69
|
Find.prune if FileTest.directory?(subpath) && ignored_dirs.include?(info.relative_path)
|
67
70
|
next unless FileTest.file?(subpath)
|
68
71
|
next if ignored_files.include?(info.relative_path)
|
69
72
|
|
70
|
-
|
73
|
+
applicable_package_managers(info).each do |package_manager|
|
74
|
+
file = info.dup
|
75
|
+
file.package_manager = package_manager
|
71
76
|
|
72
|
-
|
77
|
+
file_list.push(file)
|
78
|
+
end
|
73
79
|
end
|
80
|
+
|
74
81
|
file_list
|
75
82
|
end
|
76
83
|
|
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.11.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: 2021-
|
11
|
+
date: 2021-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: toml-rb
|
@@ -216,6 +216,7 @@ executables:
|
|
216
216
|
extensions: []
|
217
217
|
extra_rdoc_files: []
|
218
218
|
files:
|
219
|
+
- ".circleci/config.yml"
|
219
220
|
- ".codeclimate.yml"
|
220
221
|
- ".github/CONTRIBUTING.md"
|
221
222
|
- ".gitignore"
|