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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c957cf70ba85bc4b713d2884060680d5c1e230c75856a740019b7948af605948
4
- data.tar.gz: 2cb0e0750ac804cfb43abfd7360fb4f5a95e8cbc42b04f34c662c2e33f1740b3
3
+ metadata.gz: ad656049717370381dab1f44bfe7b0da145a5428b04e9366519c3f39f8bdf2aa
4
+ data.tar.gz: 8e30a85be3b00e5d56ae5826ecd0fef20c4d4bc348486a54cfdb0f26e0892262
5
5
  SHA512:
6
- metadata.gz: c3a0acdad28442902ec7e3c09fb221acbb3b2d523bf9821b5e6076ecadeed3c41c6eba921cbe56d5c87e23289a0fc445c92b128afed9263bf454d59e69c4e785
7
- data.tar.gz: fbced6acbb01eca0f3132c23bbe14d7bbf4ad50a591d013fe3e09d418103a325196e6ff671b4948307e9f68747bda8b579e60465b8fec935858484a4f8473fa0
6
+ metadata.gz: b852fe3cb0da5168a2de6b25dac9bfb9335aba3f3eb2d36ca04db1c4492d7e150d30037a2d41571861fe15b1a8beb2094312bb71c3ef0e43d2a553c7991c714c
7
+ data.tar.gz: 05e20877ea6700d89dc33f61dde31a63b8352435c72a27dd881ae7521dac2f6c6fb770ae7c46488c2ee5dd5e43a32e77e6c41f6329fff049625e04aab2f11763
@@ -4,6 +4,8 @@ rvm:
4
4
  cache: bundler
5
5
  before_install:
6
6
  - gem update --system
7
+ - gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
8
+ - gem install bundler -v '< 2'
7
9
  script:
8
10
  - bundle exec rake spec && bundle exec codeclimate-test-reporter
9
11
  notifications:
data/README.md CHANGED
@@ -97,6 +97,9 @@ All available config options are in: https://github.com/librariesio/bibliothecar
97
97
  - Podfile
98
98
  - Podfile.lock
99
99
  - *.podspec
100
+ - Anaconda
101
+ - environment.yml
102
+ - environment.yaml
100
103
  - Clojars
101
104
  - project.clj
102
105
  - Meteor
@@ -106,7 +106,7 @@ module Bibliothecary
106
106
  matching_info = file_info_list
107
107
  .select(&method(:match_info?))
108
108
 
109
- matching_info.map do |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
@@ -1,3 +1,3 @@
1
1
  module Bibliothecary
2
- VERSION = "6.7.4"
2
+ VERSION = "6.8.0"
3
3
  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.7.4
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-07-23 00:00:00.000000000 Z
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