bibliothecary 6.10.1 → 6.10.6

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: f69e23d022b216f39433b7628672b1ba5556815ba5df6d96718280e8728f53c8
4
- data.tar.gz: 80e4095a6325c6b6589b1ce7be6fbe290b238522d81a45b7faceb462f5167a2c
3
+ metadata.gz: 1b8ae8af99a91ccccfdaaf8a18aa03ff134856f4ff0bd3579ef0955ff28bb6b6
4
+ data.tar.gz: 7eeb154cbcc23edb621e3a1f332264bac5fe716d4e5026c20c072f14e60156b2
5
5
  SHA512:
6
- metadata.gz: 9c6f9d2e2fa68ead83476b974595eb4e6251cd27b8f72751e928e39607dd6184f74e0c5c367bd058a8772195c533b1f4c07d3b72c4fd4d8582464ebc5e38834b
7
- data.tar.gz: ed8ab5fe2320cda2c4decddeaf0b4442169a91f8369e9ee1ca8fda56724aed8117613f2fbbd33503ec51d8288aa66844aa56c12ff4c2e15d90d37457efd8d423
6
+ metadata.gz: 4fb19ca3ce60f786ee92a013ac6cddd2b29f8400ae7f3dce1258794360f90f3afd4b9bd594e9da34c4da2b2cae5ebc8936cc288ec0341710836ef0d13bffd210
7
+ data.tar.gz: f9e7a66faa72e61b47dff0b73a6e80af515746a1de3e333eed4930560f2eff9519f785e303412c9774a812080a4926f317f5c8a895c9d568f768f6c78ff9f67f
@@ -153,12 +153,21 @@ module Bibliothecary
153
153
  .uniq
154
154
  end
155
155
  def self.parse_maven_tree(file_contents)
156
- captures = file_contents.scan(/\s([\w.-]+:[\w.-]+:[\w.-]+:[\w.-]+:[a-zA-Z]+)/).flatten.uniq
156
+ file_contents = file_contents.gsub(/\r\n?/, "\n")
157
+ captures = file_contents.scan(/^\[INFO\](?:(?:\+-)|\||(?:\\-)|\s)+((?:[\w\.-]+:)+[\w\.\-${}]+)/).flatten.uniq
157
158
  captures.map do |item|
159
+ parts = item.split(":")
160
+ case parts.count
161
+ when 4
162
+ version = parts[-1]
163
+ type = parts[-2]
164
+ when 5..6
165
+ version, type = parts[-2..]
166
+ end
158
167
  {
159
- name: item.split(":")[0..1].join(":"),
160
- requirement: item.split(":")[3],
161
- type: item.split(":")[-1]
168
+ name: parts[0..1].join(":"),
169
+ requirement: version,
170
+ type: type
162
171
  }
163
172
  end
164
173
  end
@@ -22,6 +22,10 @@ module Bibliothecary
22
22
  match_filename("package-lock.json") => {
23
23
  kind: 'lockfile',
24
24
  parser: :parse_package_lock
25
+ },
26
+ match_filename("npm-ls.json") => {
27
+ kind: 'lockfile',
28
+ parser: :parse_ls
25
29
  }
26
30
  }
27
31
  end
@@ -75,6 +79,25 @@ module Bibliothecary
75
79
  }
76
80
  end
77
81
  end
82
+
83
+ def self.parse_ls(file_contents)
84
+ manifest = JSON.parse(file_contents)
85
+
86
+ transform_tree_to_array(manifest.fetch('dependencies', {}))
87
+ end
88
+
89
+ private_class_method def self.transform_tree_to_array(deps_by_name)
90
+ deps_by_name.map do |name, metadata|
91
+ [
92
+ {
93
+ name: name,
94
+ requirement: metadata["version"],
95
+ lockfile_requirement: metadata.fetch("from", "").split('@').last,
96
+ type: "runtime"
97
+ }
98
+ ] + transform_tree_to_array(metadata.fetch("dependencies", {}))
99
+ end.flatten(1)
100
+ end
78
101
  end
79
102
  end
80
103
  end
@@ -1,3 +1,3 @@
1
1
  module Bibliothecary
2
- VERSION = "6.10.1"
2
+ VERSION = "6.10.6"
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.10.1
4
+ version: 6.10.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Nesbitt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-16 00:00:00.000000000 Z
11
+ date: 2021-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: toml-rb
@@ -288,7 +288,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
288
288
  - !ruby/object:Gem::Version
289
289
  version: '0'
290
290
  requirements: []
291
- rubygems_version: 3.0.3
291
+ rubygems_version: 3.1.2
292
292
  signing_key:
293
293
  specification_version: 4
294
294
  summary: Find and parse manifests