bibliothecary 8.8.0 → 9.0.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: d1780d8940244ee5e96aab6ad08266b28f1bfac65eabb9ae2fc811712ddbbb3a
4
- data.tar.gz: ac03558d5e3f9f127664c8420f31273b3eacfefccc4c193c1aa6830f2b54f749
3
+ metadata.gz: 5ee8f5b235766985dfe5ebab204d9102ab1ccaaa9d554bfe554717e5714a4d6a
4
+ data.tar.gz: 7c151adfd305c726b1fb071e057499b6db8e9ed23af5cae870faed1237ca3f12
5
5
  SHA512:
6
- metadata.gz: 0ba1a48525ff6a464715b4d8210d5edf6269a31a785d2038f9228e5b591e83c128ff9adb33bc12d427da134afafb5e1b3808092f272105a7896e1db8895e67f6
7
- data.tar.gz: 3737f2812866ea2d79f94d5c1dfecfcfb822ec2496d8eb013319d72d3218e8e4deb988232b046886ee616688f9cebd6c5c131186f8db2289bd3b372eb3dd8a67
6
+ metadata.gz: 23631d08bd943cf601e1304bcc4dfc02eb61dc23813919e5f3c3fc46c747ebb38d827f11ae559f80004c47751e74adc4aa98792d0176bec0ff3edff239018827
7
+ data.tar.gz: 3216f53aa721364f9f0209cb30a8b6a000e672a7ba874f4b5d2282a100611c5f1a26d9c921020fd3c4bf3e39ee0cb89ccbd63d91bfe462967ac85c28cd5b5e79
data/.circleci/config.yml CHANGED
@@ -1,37 +1,45 @@
1
1
  version: 2.1
2
2
  orbs:
3
- ruby: circleci/ruby@0.1.2
3
+ ruby: circleci/ruby@2.1.3
4
4
 
5
5
  executors:
6
6
  bibliothecary:
7
7
  docker:
8
- - image: cimg/ruby:2.7.1
8
+ - image: cimg/ruby:3.0.7
9
9
  working_directory: ~/bibliothecary
10
10
 
11
+
12
+ commands:
13
+ setup-ruby-env:
14
+ description: "Some requirements to ensure that the ruby orb install-deps works"
15
+ steps:
16
+ - run:
17
+ name: Prep ruby
18
+ command: |
19
+ touch /tmp/ruby-project-lockfile
20
+ bundle lock --add-platform x86_64-linux
21
+ - ruby/install-deps:
22
+ bundler-version: "2.3"
23
+
24
+
11
25
  jobs:
12
26
  test:
13
27
  executor: bibliothecary
14
28
  steps:
15
29
  - checkout
16
- - run:
17
- name: Which bundler?
18
- command: bundle -v
19
- - ruby/bundle-install
30
+ - setup-ruby-env
20
31
  - run:
21
32
  name: Run specs
22
33
  command: bundle exec rake spec
23
34
  - run:
24
35
  name: CodeClimate
25
- command: bundle exec codeclimate-test-reporter
36
+ command: bundle exec codeclimate-test-reporter
26
37
 
27
38
  lint:
28
39
  executor: bibliothecary
29
40
  steps:
30
41
  - checkout
31
- - run:
32
- name: Which bundler?
33
- command: bundle -v
34
- - ruby/bundle-install
42
+ - setup-ruby-env
35
43
  - run:
36
44
  name: Run specs
37
45
  command: bundle exec rake lint
data/.rubocop.yml CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  AllCops:
4
4
  DisabledByDefault: true
5
- TargetRubyVersion: 2.7
5
+ TargetRubyVersion: 3.0
6
6
 
7
7
 
8
8
  Metrics/BlockLength:
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.7.6
1
+ 3.0.7
data/README.md CHANGED
@@ -7,7 +7,7 @@ Dependency manifest parsing library for https://libraries.io
7
7
 
8
8
  ## Installation
9
9
 
10
- Requires Ruby 2.7 or above.
10
+ Requires Ruby 3.0 or above.
11
11
 
12
12
  Add this line to your application's Gemfile:
13
13
 
@@ -9,8 +9,8 @@ module Bibliothecary
9
9
  # Optional Group 2 is [extras].
10
10
  # Capture Group 3 is Version
11
11
  REQUIRE_REGEXP = /([a-zA-Z0-9]+[a-zA-Z0-9\-_\.]+)(?:\[.*?\])*([><=\w\.,]+)?/
12
-
13
12
  REQUIREMENTS_REGEXP = /^#{REQUIRE_REGEXP}/
13
+
14
14
  MANIFEST_REGEXP = /.*require[^\/]*(\/)?[^\/]*\.(txt|pip|in)$/
15
15
  # TODO: can this be a more specific regexp so it doesn't match something like ".yarn/cache/create-require-npm-1.0.0.zip"?
16
16
  PIP_COMPILE_REGEXP = /.*require.*$/
@@ -45,6 +45,10 @@ module Bibliothecary
45
45
  kind: "lockfile",
46
46
  parser: :parse_requirements_txt,
47
47
  },
48
+ match_filename("pip-dependency-graph.json") => { # Exported from pipdeptree --json
49
+ kind: "lockfile",
50
+ parser: :parse_dependency_tree_json,
51
+ },
48
52
  match_filename("setup.py") => {
49
53
  kind: "manifest",
50
54
  parser: :parse_setup_py,
@@ -226,6 +230,18 @@ module Bibliothecary
226
230
  # should be treated as.
227
231
  NoEggSpecified = Class.new(ArgumentError)
228
232
 
233
+ def self.parse_dependency_tree_json(file_contents, options: {})
234
+ JSON.parse(file_contents)
235
+ .map do |pkg|
236
+ {
237
+ name: pkg.dig("package", "package_name"),
238
+ requirement: pkg.dig("package", "installed_version"),
239
+ type: "runtime",
240
+ }
241
+ end
242
+ .uniq
243
+ end
244
+
229
245
  # Parses a requirements.txt file, following the
230
246
  # https://pip.pypa.io/en/stable/cli/pip_install/#requirement-specifiers
231
247
  # and https://pip.pypa.io/en/stable/topics/vcs-support/#git.
@@ -252,10 +268,7 @@ module Bibliothecary
252
268
  deps << result.merge(
253
269
  type: type
254
270
  )
255
- else
256
- match = line.delete(" ").match(REQUIREMENTS_REGEXP)
257
- next unless match
258
-
271
+ elsif (match = line.delete(" ").match(REQUIREMENTS_REGEXP))
259
272
  deps << {
260
273
  name: match[1],
261
274
  requirement: match[-1] || "*",
@@ -263,7 +276,8 @@ module Bibliothecary
263
276
  }
264
277
  end
265
278
  end
266
- deps
279
+
280
+ deps.uniq
267
281
  end
268
282
 
269
283
  def self.parse_requirements_txt_url(url)
@@ -1,3 +1,3 @@
1
1
  module Bibliothecary
2
- VERSION = "8.8.0"
2
+ VERSION = "9.0.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: 8.8.0
4
+ version: 9.0.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: 2024-05-09 00:00:00.000000000 Z
11
+ date: 2024-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tomlrb
@@ -341,7 +341,7 @@ 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
344
+ rubygems_version: 3.2.33
345
345
  signing_key:
346
346
  specification_version: 4
347
347
  summary: Find and parse manifests