bibliothecary 5.0.1 → 5.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/bibliothecary/analyser.rb +1 -1
- data/lib/bibliothecary/parsers/pypi.rb +55 -1
- data/lib/bibliothecary/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a73ecad5bf0a411b2eab208e5da2fe8b9cb8c36
|
4
|
+
data.tar.gz: 0869502853eaea04bdaed75aaad6409ae5c03db2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ae3763a2b36c3496ec8208f12d2315047649a7970d4f55df8842d2f7f1d9016c8d2d86984bc1172642e22eb941b014833416cba107c55dd1e17d89af6ade1e0
|
7
|
+
data.tar.gz: 0b6006e9ce5aad4d2a4d5c1d707cd98b5e1d885f2d01c6143d5a03bad60d60c5a50c860e369322c75b14a0a72402d84f143891b60e3ffbf0b5e33efc8a3bf4c8
|
data/README.md
CHANGED
@@ -12,11 +12,65 @@ module Bibliothecary
|
|
12
12
|
parse_requirements_txt(contents)
|
13
13
|
elsif filename.match(/setup\.py$/)
|
14
14
|
parse_setup_py(contents)
|
15
|
+
elsif filename.match(/^Pipfile$/)
|
16
|
+
parse_pipfile(contents)
|
17
|
+
elsif filename.match(/^Pipfile\.lock$/)
|
18
|
+
parse_pipfile_lock(contents)
|
15
19
|
end
|
16
20
|
end
|
17
21
|
|
18
22
|
def self.match?(filename)
|
19
|
-
is_requirements_file(filename) ||
|
23
|
+
is_requirements_file(filename) ||
|
24
|
+
filename.match(/setup\.py$/) ||
|
25
|
+
filename.match(/Pipfile$/) ||
|
26
|
+
filename.match(/Pipfile\.lock$/)
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.parse_pipfile(file_contents)
|
30
|
+
manifest = TOML.parse(file_contents)
|
31
|
+
map_dependencies(manifest['packages'], 'runtime') + map_dependencies(manifest['dev-packages'], 'develop')
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.map_dependencies(packages, type)
|
35
|
+
return [] unless packages
|
36
|
+
packages.map do |name, info|
|
37
|
+
{
|
38
|
+
name: name,
|
39
|
+
requirement: map_requirements(info),
|
40
|
+
type: type
|
41
|
+
}
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.map_requirements(info)
|
46
|
+
if info.is_a?(Hash)
|
47
|
+
if info['version']
|
48
|
+
info['version']
|
49
|
+
elsif info['git']
|
50
|
+
info['git'] + '#' + info['ref']
|
51
|
+
else
|
52
|
+
'*'
|
53
|
+
end
|
54
|
+
else
|
55
|
+
info || '*'
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.parse_pipfile_lock(file_contents)
|
60
|
+
manifest = JSON.parse(file_contents)
|
61
|
+
deps = []
|
62
|
+
manifest.each do |group, dependencies|
|
63
|
+
next if group == "_meta"
|
64
|
+
group = 'runtime' if group == 'default'
|
65
|
+
dependencies.each do |name, info|
|
66
|
+
deps << {
|
67
|
+
name: name,
|
68
|
+
requirement: map_requirements(info),
|
69
|
+
type: group
|
70
|
+
}
|
71
|
+
end
|
72
|
+
end
|
73
|
+
deps
|
20
74
|
end
|
21
75
|
|
22
76
|
def self.parse_setup_py(manifest)
|
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: 5.0.
|
4
|
+
version: 5.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Nesbitt
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: toml-rb
|