bibliothecary 8.7.2 → 8.7.4

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: 1c9c1312c6588259452d5c80c4196cef2df7da9b72bfcee0edc470d38937b90c
4
- data.tar.gz: c5cb844eea89ab1799a87374aa68313b997fcf05d6df1580898c66b2675743ed
3
+ metadata.gz: 1498d2e39e0820cce0a03669d89bd6416b5afd67d1f0769602b1715a57a8ffc0
4
+ data.tar.gz: bd5d0f8c450b22c63106f4866c6d191dc3a3628eaf0f53fc341fb5e0663f33b1
5
5
  SHA512:
6
- metadata.gz: e9f226b41b25dd246f2fefe16982ef99b43a2d3ae046ae67882acc0b8a69ba4dfab2213d091ca93f306dbe5e5a97ba59c38c352d9b99a2e90ee09b2b79f569e5
7
- data.tar.gz: 2fb86982c8305897c48718ed8fd358438d4bb7231369127d320baa1663347a7dac49e56493c60f1e0593ddde6894ec8556ed4202f7415222589b3bd9b556ba9c
6
+ metadata.gz: 345d4049074667e97ca9a8c57a0b0327443a60fd5efc7b7566ef19154e1a95e395a4ef45b49f4bd20dfbeaf80c397f8cfab6b8f00203005f33ec60a1c2590270
7
+ data.tar.gz: 7e3a43056de7cfde69fa6bd6ab8329fb226ec65a591e4c4301fb39a8368e80974e112bce577d5a0bbdee42448edc5b692c68b058525d46c28c1235a09f412038
@@ -42,7 +42,7 @@ module Bibliothecary
42
42
 
43
43
  dependencies_to_analysis(info, kind, dependencies)
44
44
  rescue Bibliothecary::FileParsingError => e
45
- Bibliothecary::Analyser::create_error_analysis(platform_name, info.relative_path, kind, e.message)
45
+ Bibliothecary::Analyser::create_error_analysis(platform_name, info.relative_path, kind, e.message, e.location)
46
46
  end
47
47
  alias analyze_contents_from_info analyse_contents_from_info
48
48
 
@@ -84,7 +84,10 @@ module Bibliothecary
84
84
 
85
85
  rescue Exception => e # default is StandardError but C bindings throw Exceptions
86
86
  # the C xml parser also puts a newline at the end of the message
87
- raise Bibliothecary::FileParsingError.new(e.message.strip, filename)
87
+ location = e.backtrace_locations[0]
88
+ .to_s
89
+ .then { |l| l =~ /bibliothecary\// ? l.split("bibliothecary/").last : l.split("gems/").last }
90
+ raise Bibliothecary::FileParsingError.new(e.message.strip, filename, location)
88
91
  end
89
92
 
90
93
  private
@@ -4,14 +4,15 @@ require_relative './analyser/analysis.rb'
4
4
 
5
5
  module Bibliothecary
6
6
  module Analyser
7
- def self.create_error_analysis(platform_name, relative_path, kind, message)
7
+ def self.create_error_analysis(platform_name, relative_path, kind, message, location=nil)
8
8
  {
9
9
  platform: platform_name,
10
10
  path: relative_path,
11
11
  dependencies: nil,
12
12
  kind: kind,
13
13
  success: false,
14
- error_message: message
14
+ error_message: message,
15
+ error_location: location,
15
16
  }
16
17
  end
17
18
 
@@ -8,9 +8,10 @@ module Bibliothecary
8
8
  end
9
9
 
10
10
  class FileParsingError < StandardError
11
- attr_accessor :filename
12
- def initialize(msg, filename)
11
+ attr_accessor :filename, :location
12
+ def initialize(msg, filename, location=nil)
13
13
  @filename = filename
14
+ @location = location # source code location of the error, e.g. "lib/hi.rb:34"
14
15
  msg = "#{filename}: #{msg}" unless msg.include?(filename)
15
16
  super("#{msg}")
16
17
  end
@@ -102,7 +102,15 @@ module Bibliothecary
102
102
  # Parse poetry [tool.poetry] deps
103
103
  poetry_manifest = file_contents.fetch('tool', {}).fetch('poetry', {})
104
104
  deps += map_dependencies(poetry_manifest['dependencies'], 'runtime')
105
+ # Poetry 1.0.0-1.2.0 way of defining dev deps
105
106
  deps += map_dependencies(poetry_manifest['dev-dependencies'], 'develop')
107
+ # Poetry's 1.2.0+ of defining dev deps
108
+ poetry_manifest
109
+ .fetch("group", {})
110
+ .each_pair do |group_name, obj|
111
+ group_name = "develop" if group_name == "dev"
112
+ deps += map_dependencies(obj.fetch("dependencies", {}), group_name)
113
+ end
106
114
 
107
115
  # Parse PEP621 [project] deps
108
116
  pep621_manifest = file_contents.fetch('project', {})
@@ -179,10 +187,10 @@ module Bibliothecary
179
187
  manifest["package"].each do |package|
180
188
  # next if group == "_meta"
181
189
  group = case package['category']
182
- when 'main'
183
- 'runtime'
184
190
  when 'dev'
185
191
  'develop'
192
+ else
193
+ 'runtime'
186
194
  end
187
195
 
188
196
  deps << {
@@ -1,3 +1,3 @@
1
1
  module Bibliothecary
2
- VERSION = "8.7.2"
2
+ VERSION = "8.7.4"
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: 8.7.2
4
+ version: 8.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Nesbitt
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-15 00:00:00.000000000 Z
11
+ date: 2023-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tomlrb
@@ -248,7 +248,7 @@ dependencies:
248
248
  - - ">="
249
249
  - !ruby/object:Gem::Version
250
250
  version: '0'
251
- description:
251
+ description:
252
252
  email:
253
253
  - andrewnez@gmail.com
254
254
  executables:
@@ -326,7 +326,7 @@ homepage: https://github.com/librariesio/bibliothecary
326
326
  licenses:
327
327
  - AGPL-3.0
328
328
  metadata: {}
329
- post_install_message:
329
+ post_install_message:
330
330
  rdoc_options: []
331
331
  require_paths:
332
332
  - lib
@@ -341,8 +341,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
341
341
  - !ruby/object:Gem::Version
342
342
  version: '0'
343
343
  requirements: []
344
- rubygems_version: 3.1.6
345
- signing_key:
344
+ rubygems_version: 3.3.22
345
+ signing_key:
346
346
  specification_version: 4
347
347
  summary: Find and parse manifests
348
348
  test_files: []