bibliothecary 8.2.0 → 8.2.1

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: 4dfafc16f9be53462f1eca5e0fa5b09dcc0a5d92531570630c087773ff87d18c
4
- data.tar.gz: 3d0045a95cc5cff513474aae337e0a032543130cc7b87144adad8033138c6e17
3
+ metadata.gz: 9768b5d4829b90bc0bda13059ae884a0f6339621b85b7fcfa8bfa472439200e5
4
+ data.tar.gz: 3a34cc4b9f483502a6a0dbe0750ebe379379e2fbfde7acfb8c5d00d29d904ccc
5
5
  SHA512:
6
- metadata.gz: f984d7445345768463af5f2cb0906bf997e56ca03842ca538b65d95764ac427ed448a062593e293eeaa33779aaa2cb9b59b18f0715de813a6f018a815a03dc3f
7
- data.tar.gz: 067f0a20d820635cd697b18c43254a818284a66b98a13367146a0f9063b63bfe9316427d32bf6b88d960f6283dd56adb4ad2f874c003c7e4c151d71181f3cd37
6
+ metadata.gz: 4eed23508e442acb7957a4e3022a0ba42eb7ce199572a04d7ab9e3c77055d259e57ade2c294ad79b21ed2e55225ac6b6bb3dc58e55db33be74100643b226b689
7
+ data.tar.gz: b94e436900019c1f5f8adeca6da6ada27131e275fdfd005d3c0d2d6a003ec89292a5631a11cc40391abcba7ee53ceb88506246faca297c1b49d0a55bb8fc9973
@@ -18,10 +18,11 @@ module Bibliothecary
18
18
  # An intentionally overly-simplified regex to scrape deps from build.gradle.kts files.
19
19
  # To be truly useful bibliothecary would need a full Kotlin parser that speaks Gradle,
20
20
  # because the Kotlin DSL has many dynamic ways of declaring dependencies.
21
- GRADLE_KTS_SIMPLE_REGEX = /(#{GRADLE_KTS_DEPENDENCY_METHODS.join('|')})\s*\(\s*"([^"]+)"\s*\)/m
22
21
 
23
- # e.g. "group:artifactId:1.2.3"
24
- GRADLE_KTS_GAV_REGEX = /([\w.-]+)\:([\w.-]+)(?:\:([\w.-]+))?/
22
+ GRADLE_KTS_VERSION_REGEX = /[\w.-]+/ # e.g. '1.2.3'
23
+ GRADLE_KTS_INTERPOLATED_VERSION_REGEX = /\$\{.*\}/ # e.g. '${my-project-settings["version"]}'
24
+ GRADLE_KTS_GAV_REGEX = /([\w.-]+)\:([\w.-]+)(?:\:(#{GRADLE_KTS_VERSION_REGEX}|#{GRADLE_KTS_INTERPOLATED_VERSION_REGEX}))?/
25
+ GRADLE_KTS_SIMPLE_REGEX = /(#{GRADLE_KTS_DEPENDENCY_METHODS.join('|')})\s*\(\s*"#{GRADLE_KTS_GAV_REGEX}"\s*\)\s*$/m # e.g. "group:artifactId:1.2.3"
25
26
 
26
27
  MAVEN_PROPERTY_REGEX = /\$\{(.+?)\}/
27
28
  MAX_DEPTH = 5
@@ -248,14 +249,13 @@ module Bibliothecary
248
249
 
249
250
  def self.parse_gradle_kts(file_contents, options: {})
250
251
  file_contents
251
- .scan(GRADLE_KTS_SIMPLE_REGEX) # match 'implementation("group:artifactId:version")'
252
- .map { |(_type, dep_match)| GRADLE_KTS_GAV_REGEX.match(dep_match) } # extract ["group", "artifactId", ?"version"]
253
- .reject { |gav_match| gav_match.nil? || gav_match[1].nil? || gav_match[2].nil? } # remove any with missing group/artifactId
254
- .map { |gav_match|
252
+ .scan(GRADLE_KTS_SIMPLE_REGEX) # match 'implementation("group:artifactId:version")'
253
+ .reject { |(_type, group, artifactId, _version)| group.nil? || artifactId.nil? } # remove any matches with missing group/artifactId
254
+ .map { |(type, group, artifactId, version)|
255
255
  {
256
- name: [gav_match[1], gav_match[2]].join(":"),
257
- requirement: gav_match[3] || "*",
258
- type: nil # TODO: we may be able to infer dep types using the _type var above.
256
+ name: [group, artifactId].join(":"),
257
+ requirement: version || "*",
258
+ type: type
259
259
  }
260
260
  }
261
261
  end
@@ -1,3 +1,3 @@
1
1
  module Bibliothecary
2
- VERSION = "8.2.0"
2
+ VERSION = "8.2.1"
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.2.0
4
+ version: 8.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Nesbitt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-29 00:00:00.000000000 Z
11
+ date: 2022-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tomlrb