bibliothecary 6.7.4 → 6.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/README.md +3 -0
- data/lib/bibliothecary/analyser.rb +3 -1
- data/lib/bibliothecary/configuration.rb +2 -0
- data/lib/bibliothecary/parsers/conda.rb +54 -0
- 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: ad656049717370381dab1f44bfe7b0da145a5428b04e9366519c3f39f8bdf2aa
|
4
|
+
data.tar.gz: 8e30a85be3b00e5d56ae5826ecd0fef20c4d4bc348486a54cfdb0f26e0892262
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b852fe3cb0da5168a2de6b25dac9bfb9335aba3f3eb2d36ca04db1c4492d7e150d30037a2d41571861fe15b1a8beb2094312bb71c3ef0e43d2a553c7991c714c
|
7
|
+
data.tar.gz: 05e20877ea6700d89dc33f61dde31a63b8352435c72a27dd881ae7521dac2f6c6fb770ae7c46488c2ee5dd5e43a32e77e6c41f6329fff049625e04aab2f11763
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -106,7 +106,7 @@ module Bibliothecary
|
|
106
106
|
matching_info = file_info_list
|
107
107
|
.select(&method(:match_info?))
|
108
108
|
|
109
|
-
matching_info.
|
109
|
+
matching_info.flat_map do |info|
|
110
110
|
analyse_contents_from_info(info)
|
111
111
|
.merge(related_paths: related_paths(info, matching_info))
|
112
112
|
end
|
@@ -117,6 +117,8 @@ module Bibliothecary
|
|
117
117
|
end
|
118
118
|
|
119
119
|
def analyse_contents_from_info(info)
|
120
|
+
# If your Parser needs to return multiple responses for one file, please override this method
|
121
|
+
# For example see conda.rb
|
120
122
|
kind = determine_kind_from_info(info)
|
121
123
|
dependencies = parse_file(info.relative_path, info.contents)
|
122
124
|
|
@@ -7,6 +7,7 @@ module Bibliothecary
|
|
7
7
|
attr_accessor :mix_parser_host
|
8
8
|
attr_accessor :gradle_parser_host
|
9
9
|
attr_accessor :yarn_parser_host
|
10
|
+
attr_accessor :conda_parser_host
|
10
11
|
attr_accessor :swift_parser_host
|
11
12
|
attr_accessor :cabal_parser_host
|
12
13
|
|
@@ -18,6 +19,7 @@ module Bibliothecary
|
|
18
19
|
@mix_parser_host = 'https://mix.libraries.io'
|
19
20
|
@gradle_parser_host = 'https://gradle-parser.libraries.io'
|
20
21
|
@yarn_parser_host = 'https://yarn-parser.libraries.io'
|
22
|
+
@conda_parser_host = 'https://conda.libraries.io'
|
21
23
|
@swift_parser_host = 'http://swift.libraries.io'
|
22
24
|
@cabal_parser_host = 'http://cabal.libraries.io'
|
23
25
|
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module Bibliothecary
|
4
|
+
module Parsers
|
5
|
+
class Conda
|
6
|
+
include Bibliothecary::Analyser
|
7
|
+
FILE_KINDS = %i[manifest lockfile]
|
8
|
+
|
9
|
+
def self.mapping
|
10
|
+
{
|
11
|
+
match_filename("environment.yml") => {
|
12
|
+
kind: FILE_KINDS
|
13
|
+
},
|
14
|
+
match_filename("environment.yaml") => {
|
15
|
+
kind: FILE_KINDS
|
16
|
+
}
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
# Overrides Analyser.analyse_contents_from_info
|
21
|
+
def self.analyse_contents_from_info(info)
|
22
|
+
results = call_conda_parser_web(info.contents)
|
23
|
+
|
24
|
+
FILE_KINDS.map do |kind|
|
25
|
+
Bibliothecary::Analyser.create_analysis(
|
26
|
+
"conda",
|
27
|
+
info.relative_path,
|
28
|
+
kind.to_s,
|
29
|
+
results[kind].map { |dep| dep.slice(:name, :requirement).merge(type: "runtime") }
|
30
|
+
)
|
31
|
+
end
|
32
|
+
rescue Bibliothecary::RemoteParsingError => e
|
33
|
+
Bibliothecary::Analyser::create_error_analysis(platform_name, info.relative_path, "runtime", e.message)
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def self.call_conda_parser_web(file_contents)
|
39
|
+
host = Bibliothecary.configuration.conda_parser_host
|
40
|
+
response = Typhoeus.post(
|
41
|
+
"#{host}/parse",
|
42
|
+
headers: {
|
43
|
+
ContentType: 'multipart/form-data'
|
44
|
+
},
|
45
|
+
# hardcoding `environment.yml` to send to `conda.libraries.io`, downside is logs will always show `environment.yml` there
|
46
|
+
body: {file: file_contents, filename: 'environment.yml'}
|
47
|
+
)
|
48
|
+
raise Bibliothecary::RemoteParsingError.new("Http Error #{response.response_code} when contacting: #{host}/parse", response.response_code) unless response.success?
|
49
|
+
|
50
|
+
JSON.parse(response.body, symbolize_names: true)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
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.8.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-
|
11
|
+
date: 2019-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: toml-rb
|
@@ -259,6 +259,7 @@ files:
|
|
259
259
|
- lib/bibliothecary/parsers/carthage.rb
|
260
260
|
- lib/bibliothecary/parsers/clojars.rb
|
261
261
|
- lib/bibliothecary/parsers/cocoapods.rb
|
262
|
+
- lib/bibliothecary/parsers/conda.rb
|
262
263
|
- lib/bibliothecary/parsers/cpan.rb
|
263
264
|
- lib/bibliothecary/parsers/cran.rb
|
264
265
|
- lib/bibliothecary/parsers/dub.rb
|