ecosystems-bibliothecary 15.3.0 → 15.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c213dba45d6c84c67ecad66538e68fbd7ff843ec5fb6f6b1d80b757ae9ab5f15
4
- data.tar.gz: a0b4a803b35d16820ed19b071ae8984efb9004ba712ca6457e6f9d9412d331e6
3
+ metadata.gz: c9b737a0f2ae5bf0446ef878a8f50074dff5b40eaaff1fbf487e35a4dc61dab7
4
+ data.tar.gz: bd98a9d57a7fab6169b011b9782bdc403dafda174505184564745963dda8c5a0
5
5
  SHA512:
6
- metadata.gz: ade8a88ba728b3d95e333000cdcde1ad8ed9ae885ab775678a1b45c3d3521705f553c293be26ce5d63002f5ec86666e29108b7b456b672c647a58d56af8dc568
7
- data.tar.gz: e5fdf2c94bde72360926307a0df9cc6d796d476aa983a5236fa5d13691c4bcf74a5e20bd3c0090725ddd37bfad8a4d0733cc6a2d99b6cf25a64a92ac6a7d507b
6
+ metadata.gz: c4a8176935149d241d23abe6be2ed8566ff33ef16fb8ca4b08a2a053e4965fee3714f941b4da9adbf287e0ee87cc068c181e4b15f8197263c8988489e1acf39b
7
+ data.tar.gz: 63fd2a8f0c168af999f2ff785e3e34189b6afe09d8c66dc4974f365461b233ca52d396667647362b23cb17aea9c3bad7c48b0778dc731b4ce4162e290fd028c8
data/CHANGELOG.md CHANGED
@@ -13,6 +13,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
13
13
 
14
14
  ### Removed
15
15
 
16
+ ## [15.4.0]
17
+
18
+ ### Added
19
+
20
+ - Parser for MODULE.bazel manifests
21
+
16
22
  ## [15.3.0]
17
23
 
18
24
  ### Added
@@ -158,7 +164,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
158
164
 
159
165
  ### Added
160
166
 
161
- - Added Bibliothecary::ParserResult class, which wraps the parsed dependencies along with the project name, if it was found in the manifest.
167
+ - Added Bibliothecary::ParserResult class, which wraps the parsed dependencies along with the project name, if it was found in the manifest.
162
168
 
163
169
  ### Changed
164
170
 
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Bibliothecary
2
2
 
3
- Dependency manifest parsing library for https://github.com/ecosyste-ms
3
+ Dependency manifest parsing library for https://github.com/ecosyste-ms
4
4
 
5
5
  This is a maintained fork of the original [Bibliothecary](https://github.com/librariesio/bibliothecary) gem, with support for additional manifest formats and bug fixes.
6
6
 
@@ -98,6 +98,8 @@ The `integrity` field is populated for lockfiles that include per-dependency has
98
98
  - environment.yaml
99
99
  - Apk
100
100
  - APKBUILD
101
+ - Bazel
102
+ - MODULE.bazel
101
103
  - BentoML
102
104
  - bentofile.yaml
103
105
  - Bower
@@ -274,6 +276,8 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
274
276
 
275
277
  To install this gem onto your local machine, run `bundle exec rake install`.
276
278
 
279
+ To regenerate the supported file formats list in this README, run `bundle exec rake readme:update`.
280
+
277
281
  To release a new version:
278
282
  * in `CHANGELOG.md`, move the changes under `"Unreleased"` into a new section with your version number
279
283
  * bump and commit the version number in `version.rb` in the `main` branch
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bibliothecary
4
+ module Parsers
5
+ class Bazel
6
+ include Bibliothecary::Analyser
7
+
8
+ BAZEL_DEP_STATEMENT = %r{
9
+ ^\s*bazel_dep\s*
10
+ (?<bal>
11
+ \(
12
+ (?:
13
+ [^()"'\\]+
14
+ | "(?:\\.|[^"\\])*"
15
+ | '(?:\\.|[^'\\])*'
16
+ | \\ .
17
+ | \g<bal>
18
+ )*
19
+ \)
20
+ )
21
+ }mx
22
+
23
+ # key/value extraction inside the call
24
+ DEPENDENCY_NAME = /(?:^|[,(]\s*)name\s*=\s*(?<quote>["'])(?<value>(?:\\.|(?!\k<quote>).)*)\k<quote>/m
25
+ DEPENDENCY_VERSION = /(?:^|[,(]\s*)version\s*=\s*(?<quote>["'])(?<value>(?:\\.|(?!\k<quote>).)*)\k<quote>/m
26
+ DEPENDENCY_TYPE = /(?:^|[,(]\s*)dev_dependency\s*=\s*(?<value>True|False)\b/m
27
+
28
+ def self.file_patterns
29
+ ["MODULE.bazel"]
30
+ end
31
+
32
+ def self.mapping
33
+ {
34
+ match_filename("MODULE.bazel") => {
35
+ kind: "manifest",
36
+ parser: :parse_module_bazel,
37
+ }
38
+ }
39
+ end
40
+
41
+ def self.parse_module_bazel(file_contents, options: {})
42
+ source = options.fetch(:filename, nil)
43
+
44
+ dependencies = file_contents.scan(BAZEL_DEP_STATEMENT).filter_map do |(statement)|
45
+ name_match = statement.match(DEPENDENCY_NAME)
46
+ next unless name_match
47
+
48
+ parsed_version = statement.match(DEPENDENCY_VERSION)
49
+ parsed_type = statement.match(DEPENDENCY_TYPE)
50
+ version = parsed_version ? parsed_version[:value] : "*"
51
+ type = parsed_type && parsed_type[:value] == "True" ? "development" : "runtime"
52
+
53
+ Dependency.new(
54
+ platform: platform_name,
55
+ name: name_match[:value],
56
+ requirement: version,
57
+ type: type,
58
+ source: source
59
+ )
60
+ end
61
+ ParserResult.new(dependencies: dependencies)
62
+ end
63
+ end
64
+ end
65
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bibliothecary
4
- VERSION = "15.3.0"
4
+ VERSION = "15.4.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecosystems-bibliothecary
3
3
  version: !ruby/object:Gem::Version
4
- version: 15.3.0
4
+ version: 15.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Nesbitt
@@ -119,6 +119,7 @@ files:
119
119
  - lib/bibliothecary/parsers/actions.rb
120
120
  - lib/bibliothecary/parsers/alpm.rb
121
121
  - lib/bibliothecary/parsers/apk.rb
122
+ - lib/bibliothecary/parsers/bazel.rb
122
123
  - lib/bibliothecary/parsers/bentoml.rb
123
124
  - lib/bibliothecary/parsers/bower.rb
124
125
  - lib/bibliothecary/parsers/cargo.rb